Log in

View Full Version : Getting form values?



Illkillutill
02-03-2012, 01:46 AM
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
02-03-2012, 01:48 AM
Close the form first then free it? Iunno I've never had this happen so that's kinda weird.

Illkillutill
02-03-2012, 01:57 AM
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
02-03-2012, 02:02 AM
Hmm... didn't work.

Simba Code:

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.
Simba Code:

CRT:= StrToInt(Form1_1.RT.TEXT);




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
02-03-2012, 02:03 AM
Aha, that was very useful man. No need to post it now cause I understand. I should have known as much. lol

Thanks again!