Request: Hide/show menus, or multiple menus
BlitzPlus Forums/BlitzPlus Programming/Request: Hide/show menus, or multiple menus
| ||
I am requesting multiple menus for a window, possibly through a hide/show menu command. Many advanced applications have menus which change according to the program state. For my own editor, I could use a flexible menu for the media browser/editor. The menu would of course change to show commands for whatever type of media was being browsed in the tabber. At the very least, an option to free the menu (and rebuild it on-the-fly) would provide a solution. |
| ||
"DITTO":) L8r, |
| ||
Here is a hack. Switch the internal menu pointer with another window, then update the menu. You could even create extra windows and "steal" their menus. Simon said the next update would have a "hidden" CreateWindow() flag, so I think this will be a good solution:window=CreateWindow("TEST",0,0,400,300) CreateMenu("File",0,WindowMenu(window)) UpdateWindowMenu window Delay 2000 ResetWindowMenu(window) CreateMenu("Eat me",0,WindowMenu(window)) UpdateWindowMenu window Delay 2000 Function ResetWindowMenu(window) oldmenu=PeekL(window+140) temp=CreateWindow("",0,0,400,300) newmenu=PeekL(temp+140) PokeL window+140,newmenu PokeL temp+140,oldmenu FreeGadget temp End Function |
| ||
I am using this method, creating a separate hidden window per menu, switching the menus on-the-fly, and then restoring the original menus in the CloseProgram() function to avoid errors. I think this is just as good as any awkward commands that might be added to handle this. |
| ||
well, that's pretty neat. thanks for the tip! |
| ||
For anyone looking for internal structures, it's easy. This is usually all it takes, although sometimes there are sub-structures that get more complicated:menu=WindowMenu(window) For n=0 to 100 If Peekl(window+n*4)=menu Notify (n*4) Next |