Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding menus to an in screen form
Message
 
To
26/12/2002 02:21:47
General information
Forum:
Visual FoxPro
Category:
Menus & Menu designer
Miscellaneous
Thread ID:
00735759
Message ID:
00735912
Views:
7
Heres a real simple method. Paste the code into a program (ex "MenuTest.PRG") and then "DO" it. The next level would be to place the labels (lblMenuA and lblMenuB) in a container and tweak the popup color scheme and border styles so they more close resemble a "real" Define Menu.

The shortcut keys (the underline) for the bar would need to be worked out. A form keypress could fire the popups. They underline would need to be layered on with a line control or a dash LABEL with a transparent backstyle.
* MenuTest.PRG
CLOSE ALL
CLEAR ALL
RELEASE ALL
PUBLIC ofrm

ofrm=CREATEOBJECT('subform')
ofrm.caption=ofrm.name
ofrm.show()
ofrm.addobject('lblMenuA','subLabelA')
ofrm.addobject('lblMenuB','subLabelB')
CLEAR EVENTS

DEFINE CLASS subLabelB as Label
top=0
width=100
left=102
height=22
visible=.t.
caption=[MenuB]
PROCEDURE click
ACTIVATE POPUP popMenuB AT 1,17
ENDPROC
ENDDEFINE

DEFINE CLASS subLabelA as Label
top=0
width=100
left=0
height=22
visible=.t.
caption=[MenuA]
PROCEDURE click
ACTIVATE POPUP popMenuA AT 1,0
ENDPROC
ENDDEFINE

DEFINE CLASS subform as Form
autocenter=.t.
PROCEDURE init
DefinePop(this.Name)
ENDPROC
showwindow=1 && Inside a Main Window
visible=.t.
ENDDEFINE

PROCEDURE DefinePop(lcFormName)
DEFINE POPUP popMenuA IN WINDOW (lcFormName) MARGIN RELATIVE;
              shortcut COLOR SCHEME 4
DEFINE BAR 3 OF popMenuA PROMPT 'Item A-1' skip for .f.
DEFINE BAR 1 OF popMenuA PROMPT 'Item A-2' skip FOR .f.
DEFINE BAR 2 OF popMenuA PROMPT 'Item A-3' skip for .F.

DEFINE POPUP popMenuB IN WINDOW (lcFormName) MARGIN RELATIVE;
             shortcut COLOR SCHEME 4
DEFINE BAR 3 OF popMenuB PROMPT 'Item B-1' skip for .f.
DEFINE BAR 1 OF popMenuB PROMPT 'Item B-2' skip FOR .f.
DEFINE BAR 2 OF popMenuB PROMPT 'Item B-3' skip for .F.
ENDPROC
* END Test Prog
>Thanks for the reply Terry, any idea where I can get some sample code for this to use as a template?
>
>Jason
Imagination is more important than knowledge
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform