MaxGUI Child gadgets (Menu)
BlitzMax Forums/BlitzMax Beginners Area/MaxGUI Child gadgets (Menu)
| ||
I acquired a habit in Blitz Plus of definign sand declaring the particluar MENU gadgets with GLOBAL vars should they be required to be CHECKED/UNCHECKED or DISABLED/ENABLED etc. This way I could reference the individual menu items themselves. --- From what I can tell from BlitzMax MaxGUI, a similar method should work, although the documentation do not anywhere give such example nor indicate at all how one might idnetify the particular gadget otherwise. --- Example: (documentation) CreateMenu"&New",MENU_NEW,filemenu,KEY_N,MODIFIER_COMMAND CreateMenu"&Open",MENU_OPEN,filemenu,KEY_O,MODIFIER_COMMAND CreateMenu"&Save",MENU_SAVE,filemenu,KEY_S,MODIFIER_COMMAND CreateMenu"",0,filemenu CreateMenu"&Close",MENU_CLOSE,filemenu,KEY_W,MODIFIER_COMMAND CreateMenu"",0,filemenu Let's say I would prefer only to have NEW or OPEN menu items in a situation where there is NO CONTENT (whatever it may be). I would seek then to disable the SAVE and CLOSE menu gadgets. The documentation explains this is simply a matter of DisableMenu(MENUGADGET:TGadget) My issue is with identifying MENUGADGET in this situation. Should I adopt a similar process as I have used for BloitzPlus : i.-e. Global SAVEMENUGADGET:TGadget Global CLOSEMENUGADGET:TGadget then actually assign these SAVEMENUGADGET=CreateMenu"&Save",MENU_SAVE,filemenu,KEY_S,MODIFIER_COMMAND CreateMenu"",0,filemenu CLOSEMENUGADGET=CreateMenu"&Close",MENU_CLOSE,filemenu,KEY_W,MODIFIER_COMMAND Or is there a 'better' practice way of doing this i.e. as some child object of the Menu object itself? MYMENU.SubMenu(n) where 'n' is a reference (such as the unique ID identifier)? |
| ||
Not sure if I have understood correctly what you mean You can use global to have each item menu (and enable, disable etc) them. You can also use arrays, or maps to keep track of ID_MENU and menu-item. |
| ||
First, there is no need for my way of keeping track of all those gadgets. But I handle them in arrays. MENUS in an array and BUTTONS in another one... Only the important ones like the window or the canvas have a unique variable the code is only symbolic: |