Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Modeless form disappears due to scope
Message
From
10/10/2011 16:16:59
 
 
To
10/10/2011 11:20:47
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01525979
Message ID:
01525994
Views:
63
>I have a question about how to keep a modeless form around after the variable it was created with loses scope.
>
>My code looks something like this:
loForm = Newobject('SomeFormClass', 'SomeLib.VCX')
>loForm.SomeProperty = .T.
>loForm.Show()
>Since the form is modeless, when the method which creates it completes, loForm goes out of scope, and my form closes. (I see it flash briefly).
>
>What's the normal way to code this so that the form hangs around?
>
>Oh, two more things
>
>(1) This method may be called more than once, so there may be multiple instances of the form running.
>(2) This is not part of an application, but runs in the IDE, so I can't have a forms manager around to do this for me.
>
>Thanks in advance,
>
>
>Jim

You can use the _screen object as a holder for global properties.
_screen.addproperty("iform")
_screen.iForm = creatobject("myformclass")
_screen.iForm.show()
Previous
Reply
Map
View

Click here to load this message in the networking platform