Is it possible to create menu items after the initial window/menu creation routine.
What I'm wanting to do, for tutorial purposes, is create or add menu items to an already created menu structure ie 'recent folders' menu item under the 'File' menu.
If this is possible, any chance of a quick snippet to get me started?
A thought that is crossing my mind is that I could remove the entire menu structure and recreate the new menu structure (I'm thinking aloud now). I'm assuming it is possible to dynamically remove a menu structure.
Any help appreciated.
Create menu items after window opened
-
- User
- Posts: 27
- Joined: Mon Oct 01, 2007 1:38 pm
- Location: Melbourne, Australia
- Contact:
Something like that?
lg
marco
Code: Select all
Global recent1.s="first Document"
Global recent2.s="second Document"
Global recent3.s=""
Global recent4.s=""
Procedure recent()
If CreateMenu(0, WindowID(0))
MenuTitle("Menu")
MenuItem(1, "first")
MenuItem(2, "second")
MenuItem(3, "last")
OpenSubMenu("recent")
If recent1<>"": MenuItem(4, recent1): EndIf
If recent2<>"": MenuItem(5, recent2): EndIf
If recent3<>"": MenuItem(6, recent3): EndIf
If recent4<>"": MenuItem(7, recent4): EndIf
CloseSubMenu()
EndIf
EndProcedure
If OpenWindow(0, 0, 0, 200, 200, "", #PB_Window_SystemMenu) And CreateGadgetList(WindowID(0))
ButtonGadget(0, 50, 50, 100, 20, "recent")
recent()
EndIf
Repeat
event=WaitWindowEvent():Select event: Case #PB_Event_Gadget: Select EventGadget()
Case 0
recent1.s="first Document"
recent2.s="second Document"
recent3.s="third Document"
recent4.s=""
If IsMenu(0)
FreeMenu(0)
EndIf
recent()
EndSelect: EndSelect
Until event=#PB_Event_CloseWindow
marco
PureBasic for Windows
-
- User
- Posts: 27
- Joined: Mon Oct 01, 2007 1:38 pm
- Location: Melbourne, Australia
- Contact: