SRL Archive - Help

Getting form values?


Illkillutill

2012-02-02 20:46:11

When a form pops up for user input, after I free it, the script cannot get info any more because it's freed, but i notice it runs slowly for the rest of the time. Do I just have to load the value's into new variables before freeing them?

Brandon

2012-02-02 20:48:59

Close the form first then free it? Iunno I've never had this happen so that's kinda weird.

Illkillutill

2012-02-02 20:57:04

Hmm… didn't work.

try
Form1_1_SafeInit;
Form1_1_SafeShowModal;
except
WriteLn(ExceptionToString(ExceptionType, ExceptionParam));
finally
Form1_1.Form1_1.ModalResult := mrOk;
Form1_1.Form1_1.Free;
end;

and i get an access violation on this line which is just after freeing the form.
CRT:= StrToInt(Form1_1.RT.TEXT);

Brandon

2012-02-02 21:02:24

From: Illkillutill
Hmm… didn't work.

Simba Code:
[LEFT]try
Form1_1_SafeInit;
Form1_1_SafeShowModal;
except
WriteLn(ExceptionToString(ExceptionType, ExceptionParam));
finally
Form1_1.Form1_1.ModalResult := mrOk;
Form1_1.Form1_1.Free;
end;
[/LEFT]


and i get an access violation on this line which is just after freeing the form.
Simba Code:
[LEFT]CRT:= StrToInt(Form1_1.RT.TEXT);
[/LEFT]



You cannot assign variables after the form has been destroyed.. it's accessing a component of a form that isn't there.. You must assign all variables before the form is destroyed. Mind posting the entire form?

Illkillutill

2012-02-02 21:03:37

Aha, that was very useful man. No need to post it now cause I understand. I should have known as much. lol

Thanks again!