Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using menu from modal form
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de menu & Menus
Divers
Thread ID:
00458308
Message ID:
00673751
Vues:
83
I just tried this again in VFP7/SP1 to be sure.

In your modal form's Init:
PUSH MENU _MSYSMENU
In your modal form's Destroy:
POP MENU _MSYSMENU
In your modal form's GotFocus:
DO yourmenu.mpr
That's it, nothing special anywhere else.



>Hi Fred,
>
>That is strange I created a simple form and made it a modal and none of the options became available. In the INIT() entered this code: PUSH MENU _MSYSMENU and in the GotFocus() entered this code: DO Test.Mpr and in the Destroy() entered POP MENU _MSYSMENU.
>
>Below is the code of the TEST.MPR file.
>The only way it works if I entered the DO Test.mpr in the Paint() method, but that is a bad choice, since it is fired all the time
>
>


>SET SYSMENU TO
>SET SYSMENU AUTOMATIC
>
>DEFINE PAD _0pc1bczsm OF _MSYSMENU PROMPT "File" COLOR SCHEME 3 ;
> KEY ALT+F, ""
>DEFINE PAD _0pc1bczsn OF _MSYSMENU PROMPT "Help" COLOR SCHEME 3 ;
> KEY ALT+H, ""
>ON PAD _0pc1bczsm OF _MSYSMENU ACTIVATE POPUP file
>ON PAD _0pc1bczsn OF _MSYSMENU ACTIVATE POPUP help
>
>DEFINE POPUP file MARGIN RELATIVE SHADOW COLOR SCHEME 4
>DEFINE BAR 1 OF file PROMPT "Close"
>DEFINE BAR 2 OF file PROMPT "\>ON SELECTION BAR 1 OF file _Screen.ActiveForm.Release()
>ON SELECTION BAR 2 OF file ;
> DO _0pc1bczsw ;
> IN LOCFILE("VREP\TEST" ,"MPX;MPR|FXP;PRG" ,"WHERE is TEST?")
>
>DEFINE POPUP help MARGIN RELATIVE SHADOW COLOR SCHEME 4
>DEFINE BAR 1 OF help PROMPT "About"
>DEFINE BAR 2 OF help PROMPT "Help"
>ON SELECTION BAR 1 OF help DO FORM About.SCX
>ON SELECTION BAR 2 OF help Help
>


>
>Also tested it under VFP6 and VFP7 and got the same results.
>What else is there?
>
>Regards,
>
>Doron
>
>>Wow, talk about a blast from the past! (18 months since that post)
>>
>>I've since found a better place for the menu.
>>
>>In your Form.Init:
>>PUSH MENU _MSYSMENU
>>
>>In your Form.GotFocus:
>>DO yourmenu.mpr
>>
>>In your Form.Destroy:
>>POP MENU _MSYSMENU
>>
>>This should work, and doesn't require a flag for the menu activation. The
>>Paint method should work, but Paint get's fired off for many reasons (one of
>>which is if you're current field has a blinking cursor!).
>>
>>
>>>Hi Fred,
>>>
>>>I tried to do what you suggested and it did not work for me.
>>>I have one main model form and entered the 2 lines in the GotFocus method and the menu options still were not available. I tried that either in VFP 6 or VFP 7. This main form is called from the main prg.
>>>
>>>PUSH MENU _msysmenu
>>>DO modal.mpr
>>>
>>>Also the other suggestion worked if I let the Paint method to be fired all the time without the IF NOT this.lMenuDone.
>>>
>>>Any ideas?
>>>
>>>Regards,
>>>
>>>Doron
>>>
>>>
>>>
>>>>>>
>>>>>>Add a property called lMenuDone to your modal form. This code in the form's Paint method:
>>>>>>
>>>>>>
>>>>>>IF NOT This.lMenuDone
>>>>>>   PUSH MENU _MSYSMENU
>>>>>>   This.lMenuDone = .T.
>>>>>>   DO MyMenu.prg
>>>>>>   DO MyMenu.prg
>>>>>>ENDIF
>>>>>>
>>>>>>
>>>>>>Then you can issue a POP MENU in the form's Unload.
>>>>>
>>>>>Marcia,
>>>>>
>>>>>why i must run
>>>>>
>>>>>DO MyMenu.prg
>>>>>
>>>>>twice?
>>>>>
>>>>>One line seems to be sufficient.
>>>>>Is it possible to use vfp standard _msysmenu (e.q.standard copy, edit,paste pads) ? I do'nt want to define new menu of each modal form.
>>>>>
>>>>>It it possible to run this code in some other event than paint (Load event)?
>>>>>I haven't never used paint.
>>>>
>>>>You can put in your Form's GotFocus:
>>>>
>>>>PUSH MENU _msysmenu
>>>>DO modal.mpr
>>>>
>>>>and in your Form's Unload:
>>>>
>>>>POP MENU _msysmenu
>>>>
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform