>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"
FOR EACH Form IN _SCREEN.Forms
IF form.Name = "MyTopForm"
DO MyMenu2.MPR WITH form
EXIT
ENDIF
ENDFOR
>
>Help me, please.