Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return value from a Form
Message
From
27/07/2011 10:40:26
 
 
To
26/07/2011 21:51:06
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01333380
Message ID:
01519324
Views:
74
Likes (1)
Hiding a modal form

One way of getting access to values that are contained within a modal form is simply to hide the form instead of releasing it. When a modal form is hidden, whichever form was active immediately prior to the modal form being instantiated becomes the active form once again. In other words, the form that called the modal form is re-activated. Providing that you have, within the calling form, a valid reference to the modal form you can access any exposed properties of the form, or of its contained controls. This approach will work irrespective of the way in which the form is instantiated.

The following code snippet shows how this might be done for a form instantiated directly from a class:
*** Instantiate a modal form
oFm = NEWOBJECT( 'modalform', 'formclasses' )
*** Show the form and ensure that it is modal
oFm.Show(1)
*** When form is 'released' it is actually hidden!
*** Access the Modal form's properties directly
ThisForm.SomeProperty = oFm.ModalFormProperty
*** Release the modal form when done
oFm.Release()
While for a form that is created from an SCX file, the following code is equivalent:
*** Instantiate the modal form
DO FORM modalform NAME oFm LINKED
*** When the modal form is "released" it is actually hidden!
*** The NAME 'oFm' can now be used to access it directly:
ThisForm.SomeProperty = oFm.ModalFormProperty
*** Release the modal form when done by releasing the "linked name"
RELEASE oFm
Previous
Reply
Map
View

Click here to load this message in the networking platform