[Gambas-user] life of an object
Benoit Minisini
gambas at ...1...
Fri Dec 2 00:12:53 CET 2005
On Wednesday 30 November 2005 22:44, Hugo wrote:
> Hi,
> when a form is closed , can I still get some atributes of it , or is it
> garbage collected right after one closes it, trouble is I need to get some
> data from a form I show to the user.
> I do something like this:
> sub getAnswerFromUser()
> Dim frm as SomeForm
> dim st as string
> frm = NEW SomeForm
> frm.title = 'Some Title'
> frm.show()
> st = frm.someAtt 'at this point a get Invalid Object runtime error
> return st 'this should be the answer
> end
> is this code correct ?
>
> thanks for any help
> Hugo
This code is correct, but a form becomes invalid as soon as it is deleted.
frm.Show() should show the form modeless, except if a modal window is already
displayed. Then it is shown modal. So it may be destroyed when frm.Show()
terminates.
If you want to have public variables in the form to return some information,
make them static. Static variables don't need any object to be valid.
Regards,
--
Benoit Minisini
More information about the User
mailing list