Hi,
I have a Command Button ("Command1") on a top level form ("Form1"),
My question.. How can I control this command Button from the menu?
for example to make it visible or not:
When you launch the form, you need to grab an object reference to it:
Code:
DO MyTopLevelForm NAME goForm
goForm will hold the reference to the form.
This variable must remain in scope while the form is open. One way to do that it to make it a public variable. Set the public variable initially to NULL. (Using public variables is generally frowned on, and there are better ways of achieving the goal, but let's keep things simple for now.)
So do this at the start of your main program:
Code:
PUBLIC goForm
goForm = NULL
Now, in your menu command, you can refer to the command button like this:
Code:
IF NOT ISNULL(goForm)
goForm.Command1.Visible = .T.
ENDIF
Give it a try.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.