Hope someone can help. I have the following function which builds a menu structure and adds from zero 'recent folders' (directory paths) to many items. The directory paths are retrieved from a linked list.
Case #PB_Event_Menu
Select EventMenu()
Case #M_ABOUT
MessageRequester("About","A program by Steve")
Case #M_QUIT
Quit = #True
My question is, how do I detect if a 'recent folder' menu item has been clicked and then retrieve the value. I'm a little confused as there could be anything from zero to say 10, 20 or 30 items.
You need a reserved ID range, e. g. 33 to 43 or somthing. To don't interfere with other Menu ID's you need to assign the ID's after all other menu items.
If EventID = #PB_Event_Menu
Select EventMenu()
Case #IDM_MenuItem1
Case #IDM_MenuItem2
Case #IDM_MenuItem3
Case #IDM_RecentStart To #IDM_RecentStart + #IDM_RecentMax
; do stuff with your recent menu ...
EndSelect
EndIf
Fluid Byte wrote:You need a reserved ID range, e. g. 33 to 43 or somthing. To don't interfere with other Menu ID's you need to assign the ID's after all other menu items.
If EventID = #PB_Event_Menu
Select EventMenu()
Case #IDM_MenuItem1
Case #IDM_MenuItem2
Case #IDM_MenuItem3
Case #IDM_RecentStart To #IDM_RecentStart + #IDM_RecentMax
; do stuff with your recent menu ...
EndSelect
EndIf
If EventID = #PB_Event_Menu
Select EventMenu()
Case #M_ABOUT
MessageRequester("About","A program by Steve")
Case #M_QUIT
Quit = #True
Default
RecentFilePath.s=GetMenuItemText(#MEMU_BAR, EventMenu())
EndSelect
EndIf
You are simply passing -1 as the ID and since MenuItem() doesn't support handles negative indexes are valid. Some commands support handles, some don't. And if a certain lib does, it's stated in the manual.
You are simply passing -1 as the ID and since MenuItem() doesn't support handles negative indexes are valid. Some commands support handles, some don't. And if a certain lib does, it's stated in the manual.
It should also be stated that it doesn't then.
Also, how then are true dynamic menus created? Maybe it should be added?
Thanks all, there's enough info here to enable me to progress my first PB application. I like Eddy's one-liner but that's not dismissing the other info put forward, I'll have to study it to make sense of it.