In VFP, the menu is not an object contained in the form.
For this reason you can't use Thisform.
You have multiple choices. I believe the following list is not exhaustive.
- you can launch the form using the Name clause
do form whatever name variablename
- you can use _screen.activeform (not always)
- you can query _screen.forms
- you can store the form reference into a public variable, or a property of a public (variable) object
- you can store the form reference into a custom property of _screen
- you can pass form's reference to the menu / menu item, if the menu is defined inside a method of the form, like :
local ofrm
ofrm = ThisForm
...
on selection whatever... do myprocedure with ofrm
Respectfully,
Vilhelm-Ion Praisach
Resita, Romania
I would favour Vilhelm-Ion's first option. Use the NAME clause to get an object reference to the form; and then keep that reference in scope, for example in a public variable.
When launching the form:
[tt]PUBLIC goMyForm
DO FORM MyForm NAME goMyForm[/tt]
Then, in your menu code:
[tt]
goMyForm.MyObject.Visible = .T.[/tt]
Using public variables is not the ideal way of keeping a variable in scope, but I used it in this example for the sake of simplicity.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Thank you Vilhelm-Ion and MikeLewis.
I decided on DO FORM with MODAL as it is essentially a utility form that will not be accessed often.
One less Container. The information you provided will be useful in the future i'm sure!
Thanks again.
Shane.
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.