Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help needed
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00156879
Message ID:
00156895
Views:
26
>Help me!
>
>I have a problem with coordinating top-level form and menus. When my application starts with top-level form, I create menu with command:
>
>DO MyMenu1.MPR With ThisForm
>
>This works well. But then I try to create new menu from existing menu. By example, a pad in my menu contains command:
>
>DO MyMenu2.MPR With ????
>
>There is my problem in application. How I can reference my top-level form? I can't find answer in help file and online documentation.

When you create the top-level form, you can save an object reference to it somewhere. If you launch the form with DO FORM, you can use the NAME clause to create a variable with the specified name that can serve as an object reference if it remains in scope, or can be used to find an object reference in the _SCREEN.Forms collection. A simple example of finding using a named form:
DO FORM frmTop NAME "MyTopForm"
*  The top-level form can be referenced as MyTopForm (it's created as a variable)
*   If MyTopForm goes out of scope, you can search the Forms collection of _SCREEN
*   as in the following example
FOR EACH Form IN _SCREEN.Forms
   IF form.Name = "MyTopForm"
      DO MyMenu2.MPR WITH form
      EXIT
   ENDIF
ENDFOR
>
>Help me, please.
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