Top level form menu & active form 
Author Message
 Top level form menu & active form

    I am starting to have my form menus execute code that manipulates the
underlying form by discovering it through the application.activeform object.
On the surface, I can't think of any time this wouldn't work since in order
to click on or hot key into the menu, the form must be the active form.
That's the assumption I'm asking about.  I haven't seen this idea discussed
anywhere so I'd like to know if I'm missing something that could move focus
away from the form while the menu is active.
    Does anyone know for sure that this won't work or assure me that it
*always* will?
-Lew


Mon, 26 Jan 2004 11:50:34 GMT  
 Top level form menu & active form

Quote:
>     I am starting to have my form menus execute code that manipulates the
> underlying form by discovering it through the application.activeform object.
> On the surface, I can't think of any time this wouldn't work since in order
> to click on or hot key into the menu, the form must be the active form.
> That's the assumption I'm asking about.  I haven't seen this idea discussed
> anywhere so I'd like to know if I'm missing something that could move focus
> away from the form while the menu is active.
>     Does anyone know for sure that this won't work or assure me that it
> *always* will?

No, it will not always work. Always check if TYPE("_SCREEN.ACTIVEFORM")
= "O" first.

--
Nancy
So that all can benefit from the discussion,
please post all followups to the newsgroup.

If you are posting about Visual FoxPro 7.0, please
include your Version and Build# (found in Help | About).



Mon, 26 Jan 2004 12:52:43 GMT  
 Top level form menu & active form
Thanks, Nancy:
    If you have the time, would you mind:
    1. Can you give me an example of something that could change the focus
away from the form?
    2. Is there a reason for preferring _screen.activeform over application.
or _VFP.? The form in question is a top level form.

Quote:

> No, it will not always work. Always check if TYPE("_SCREEN.ACTIVEFORM")
> = "O" first.

> --
> Nancy



Mon, 26 Jan 2004 20:13:07 GMT  
 Top level form menu & active form

Quote:
> Thanks, Nancy:
>     If you have the time, would you mind:
>     1. Can you give me an example of something that could change the focus
> away from the form?

The toplevel form? Or a form in general? Activating another form in the
case of the latter.

Quote:
>     2. Is there a reason for preferring _screen.activeform over application.
> or _VFP.? The form in question is a top level form.

It depends on what you're using. I use an application object in one
project. Another uses TopLevelForms. So, I don't use _SCREEN, really.
I'm trying to think where I do at all, and can't.  _VFP refers to the
VFP application object. Not pertinent.

When I said:

Quote:
> > No, it will not always work. Always check if TYPE("_SCREEN.ACTIVEFORM")
> > = "O" first.

I should have said: I wouldn't not code with the expectation that
_ACTIVEFORM is always valid.

--
Nancy
So that all can benefit from the discussion,
please post all followups to the newsgroup.

If you are posting about Visual FoxPro 7.0, please
include your Version and Build# (found in Help | About).



Tue, 27 Jan 2004 00:13:36 GMT  
 Top level form menu & active form
I guess I'm being too general. All of my forms have a 'MenuChoice' property
and a MenuChoice_assign method. When I use a top level form menu, I have the
menu communicate with the underlying form via statements like:
application.activeform.MenuChoice = <whatever>. This way, all the menu
handling code stays in the hosting form, not the menu.  I was wondering if
focus might ever be moved away from the form hosting the menu at the time
the assignment statement fires with the result that code in a different form
would be called or an error generated.
-Lew


Fri, 30 Jan 2004 21:20:30 GMT  
 Top level form menu & active form

Quote:
> I guess I'm being too general. All of my forms have a 'MenuChoice' property
> and a MenuChoice_assign method. When I use a top level form menu, I have the
> menu communicate with the underlying form via statements like:
> application.activeform.MenuChoice = <whatever>. This way, all the menu
> handling code stays in the hosting form, not the menu.  I was wondering if
> focus might ever be moved away from the form hosting the menu at the time
> the assignment statement fires with the result that code in a different form
> would be called or an error generated.

I don't know that you'll have any problem, at all. I would just check
that activeform is valid before just calling the code, though, that's
all.

--
Nancy
"If it's not burned, it's sushi." --
Nancy's school of cooking



Sat, 31 Jan 2004 13:18:40 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. About Menus & Top Level Forms

2. About Top Level Forms & Menus

3. addressing form from menu on top level form ?

4. Top Level Form, Menus and Form's Properties

5. Top Level Form Menus

6. Menus on top level forms....

7. Vfp top level forms and menu bars

8. Own menu in Top-Level forms!

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

10. VFP 6.O Top-Level Form Menu

11. Disable Top Level Form Menu selections in VFP.

12. Disabling menus on top-level forms

 

 
Powered by phpBB® Forum Software