Hi Jerry

You call a menu from a top level form with this syntax:

DO mymenu.mpr WITH THIS , .T.

You can call the above statement from the init of the TL form or from its 
activate method

Every time you call a form (show window property = 1, In top level form) you 
are actually creating a reference to the form.

You could try this:

public oMyForm
do form myform name oMyForm linked

In this manner, the oMyForm object created above is public, meaning, it can 
be seen by any method in any  form called subsequently from the menu.

You would then use this syntax to call a method in the first form, from any 
other form.

oMyForm.method.

As an example, suppose you called a form called form1 from the menu, but 
with the visible property set to false. You would run the following snippet 
from a procedure in your menu:

public oMyForm
do form form1 name oMyForm linked
do form form2

Since the form1's visible property is set to .f., the user would not see it. 
The third line of code calls the second form, which is visible.

Then you can call a method in the first form, from any method in the second 
form, thus:

oMyForm.method

So, assuming your first form had a method called 'calculations' (a 
calculator) that would take three parameters (the mathematical operation,and 
the two factors),and you would need to use this method from other forms, in 
our example, from form2, you would call it like so:

local nResult,nA,nB

nA = 5
nB = 7

nResult = oMyForm.calculations('multiplication',nA,nB)   && result = 35

I guess this is what you asked, anyways.

Rafael Copquin


>
> -----Original Message-----
> From: Jerry Foote
> Sent: Sunday, April 05, 2009 6:59 PM
>
> In VFP 9.0 I set a menu as top level and edited the setup to include the
> statement. parameters calling_form
>
> In my init I call do menubars.mpr with thisform
>
> When the exe runs I get the error unrecognized command verb with  the
> parameters calling_form highlighted..
>
> I see code above that with LPARAMETERS oFormRef, getMenuName, 
> lUniquePopups,
> parm4, parm5, parm6, parm7, parm8, parm9
>
> LOCAL cMenuName, nTotPops, a_menupops, cTypeParm2, cSaveFormName
>
>
>
> I assume fox puts this in but I'm not sure how to use it.
>
> I want to call routines in the calling form from the menu bars, I remember
> using 'calling_form.dosomething'
>
>
>
> I tired oFormRef.dosomething but that did not work..
>
> calling_form.dosomething does not work..
>
> How do I get a reference in the menu to call a method on the form
>
>
>
> Thanks Jerry
>
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/6397fefa303a4a059e39f97ce6d3c...@rafael
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to