HOWTO: Use the _ShortCutMenu Foundation Class
ID: Q193783
|
The information in this article applies to:
-
Microsoft Visual FoxPro for Windows, version 6.0
SUMMARY
This article describes how to create a shortcut menu using the
_ShortCutMenu Foundation Class in the _menu.vcx class library.
MORE INFORMATION
The _ShortCutMenu Foundation Class allows you to bold, disable, and place a
check mark next to the menu prompt.
The following example shows how to use the _ShortCutMenu Foundation Class:
- Create a form named Myshortmenu.
- Add the _ShortCutMenu class, located in the _menu.vcx, to the form. The
_menu.vcx file resides in the Home()\FFC folder.
- Create two custom properties for the form, lcheck, and lbold. Next,
create a custom method, called Myproc, for the form.
- In the RightClick event of the form, place the following code:
PRIVATE oTHISForm
oTHISFORM = Thisform
Thisform._shortcutmenu1.ClearMenu
WITH Thisform._shortcutmenu1
.AddMenuBar("AAA",[wait window "AAA"])
.AddMenuSeparator()
.AddMenuBar("Check/UnCheck CCC",[oTHISFORM.myproc(prompt())])
.AddMenuBar("BBB",[wait window "BBB"])
.AddMenuBar("CCC",[wait window "CCC"],,,oTHISFORM.lcheck)
.AddMenuBar("DDD",[wait window "DDD"],,,,.T.)
.AddMenuBar("EEE",[oTHISFORM.myproc(prompt())],,,,,oTHISFORM.lbold)
ENDWITH
Thisform._shortcutmenu1.ShowMenu()
- In the custom Myproc method, place the following code:
PARAMETER cPrompt
DO CASE
CASE cPrompt = "Check/UnCheck CCC"
IF Thisform.lcheck
Thisform.lcheck = .F.
WAIT WINDOW "PPP is now unchecked" NOWAIT
ELSE
Thisform.lcheck = .T.
WAIT WINDOW "PPP is now checked" NOWAIT
ENDIF
CASE cPrompt = "EEE"
IF Thisform.lbold
Thisform.lbold = .F.
ELSE
Thisform.lbold = .T.
ENDIF
ENDCASE
- Save and run the form.
Right-click the form and select "Check/UnCheck CCC" to either place or
remove a check mark next to the "CCC" menu prompt. A WAIT WINDOW command
appears each time you toggle the check mark. Select the "EEE" prompt to
toggle the bold face on or off.
Additional query words:
kbVFp600 kbFFC
Keywords :
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbhowto
|