Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Controlling another form from current form
Message
From
21/12/1999 11:13:15
 
 
To
21/12/1999 10:51:00
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00284853
Message ID:
00306714
Views:
26
>Hi Ed,
>
>Thanks for the very thorough explanation. Is this the only way to call a method from another form if the forms not part of a class? I could have sworn a couple of years ago I simply used something like _screen.forms. . . .yada yada.

yep - _Screen.Forms(Item id).MethodToInvoke is equivalent to the resolved oForm.MethodToInvoke; _Screen.Forms(Item id).Control.MethodToInvoke == oForm.Control.MethodToInvoke etc.

Look at it this way:

oForm = _Screen.Forms(Item id)
oForm.MethodToInvoke()

You can assign an object reference at any level of the object hierarchy to a memvar.

Forms are always objects, regardless of how they're instantiated. All the FOR EACH does is iterate through the Forms collection without externally tracking the member's position. You can use a FOR...NEXT loop and iterate the item id, but as noted, invoking the Release method changes the member count and order, and gets all busted up when you iterate past the last member, and may skip members because of resequencing. And it's possible to have forms that are not a part of the _Screen.Forms collection...so you're best off looking into an application object that tracks form references to make retrieving their object refs easier.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform