Top Level Form, Menus and Form's Properties 
Author Message
 Top Level Form, Menus and Form's Properties

Hi,

I am using a top level form and a menu on this form.
I can not figure out how to access the properties and/or methods of this
form from it's menu.
Can you please help ?

Demetrios,
Greece



Sun, 25 May 2003 03:00:00 GMT  
 Top Level Form, Menus and Form's Properties
You have a couple choices:

1) When you instantiate the form, give it a name that has the necessary
scope (likely PUBLIC).  Then you can call the form by name:

        * in the beginning:
        PUBLIC goForm
        DO FORM myTopLevelForm NAME goForm
        READ EVENTS

        * in the menu code:
        goForm.CustomMethod()

2) If this is the only active form at the time the menu is being used, you
can use _SCREEN.ActiveForm to reference the form.

--
Seairth Jacobs



Quote:
> Hi,

> I am using a top level form and a menu on this form.
> I can not figure out how to access the properties and/or methods of this
> form from it's menu.
> Can you please help ?

> Demetrios,
> Greece



Sun, 25 May 2003 03:00:00 GMT  
 Top Level Form, Menus and Form's Properties
Seairth,

Thank you. I thought something like that (using a public variable) but I
didn't like the idea using public variables.
Besides, if create another copy of the same form, the public variable will
change.

I call the menu from myTopLevelForm.init method using the command:
  do TopLevelMenu.mpr with This
But I can not access the 'This' from the menu.

Demetrios


Quote:
> You have a couple choices:

> 1) When you instantiate the form, give it a name that has the necessary
> scope (likely PUBLIC).  Then you can call the form by name:

>         * in the beginning:
>         PUBLIC goForm
>         DO FORM myTopLevelForm NAME goForm
>         READ EVENTS

>         * in the menu code:
>         goForm.CustomMethod()

> 2) If this is the only active form at the time the menu is being used, you
> can use _SCREEN.ActiveForm to reference the form.

> --
> Seairth Jacobs




> > Hi,

> > I am using a top level form and a menu on this form.
> > I can not figure out how to access the properties and/or methods of this
> > form from it's menu.
> > Can you please help ?

> > Demetrios,
> > Greece



Mon, 26 May 2003 11:27:36 GMT  
 Top Level Form, Menus and Form's Properties
Seairth

Well, that what I didn't think off, is that the form that get's the focus
may re-aply the form's name into that public variable you were talking
about.
So the problem maybe solved as you proposed.

Demetrios


Quote:
> Seairth,

> Thank you. I thought something like that (using a public variable) but I
> didn't like the idea using public variables.
> Besides, if create another copy of the same form, the public variable will
> change.

> I call the menu from myTopLevelForm.init method using the command:
>   do TopLevelMenu.mpr with This
> But I can not access the 'This' from the menu.

> Demetrios



> > You have a couple choices:

> > 1) When you instantiate the form, give it a name that has the necessary
> > scope (likely PUBLIC).  Then you can call the form by name:

> >         * in the beginning:
> >         PUBLIC goForm
> >         DO FORM myTopLevelForm NAME goForm
> >         READ EVENTS

> >         * in the menu code:
> >         goForm.CustomMethod()

> > 2) If this is the only active form at the time the menu is being used,
you
> > can use _SCREEN.ActiveForm to reference the form.

> > --
> > Seairth Jacobs




> > > Hi,

> > > I am using a top level form and a menu on this form.
> > > I can not figure out how to access the properties and/or methods of
this
> > > form from it's menu.
> > > Can you please help ?

> > > Demetrios,
> > > Greece



Mon, 26 May 2003 15:12:40 GMT  
 Top Level Form, Menus and Form's Properties
Hi Demetrios,
why don't use _screen.activeform, it's allready there and no extra
coding :o).
In the menu code you just put _screen.activeform.doYourMethod().
Take a look at the _screen object, it contains a lot of nice stuff!
/Ulf


Mon, 26 May 2003 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. addressing form from menu on top level form ?

2. Top level form menu & active form

3. Top Level Form Menus

4. Menus on top level forms....

5. Vfp top level forms and menu bars

6. Own menu in Top-Level forms!

7. Error with menu on a top-level form - VFP7

8. VFP 6.O Top-Level Form Menu

9. Disable Top Level Form Menu selections in VFP.

10. Disabling menus on top-level forms

11. Top-level Forms and Menus

12. Top level Form, menu and Status Bar

 

 
Powered by phpBB® Forum Software