On 07/18/12 02:29, M3taSpl0it wrote: > As you can see fltk documentation calls '/' actually a totally unnecessary > feature.
Note this is in the context of Fl_Menu_Item::add(), and not Fl_Menu_::add(). When creating menu items in a menu bar, I find it best to use: Fl_Menu_Bar menubar(..); menubar.add("File/Open", ..); menubar.add("File/Save", ..); menubar.add("File/Save As", ..); menubar.add("File/Quit", ..); ..which uses Fl_Menu_::add(). Fl_Menu_Item is a different story, as each entry in the menus are an Fl_Menu_Item, so to work with its add() feature would be to work with the menus at a much lower level where the menu item pointer might itself become deallocated. The thing to remember about Fl_Menu based widgets is adding to the menu can cause the menu's array pointers to change around, which is why it's bad to keep track of item pointers while adjusting the menus; they can become stale. So instead of using: const Fl_Menu_Item *openitem = menubar.add("File/Open", ..); ..and then trying to keep that item pointer around for later use, it's better to call find_item("File/Open") to get the items pointer when you need it, since it may change from time to time, esp. when the menubar's contents is adjusted (ie. items added or removed) > Can you explain me above para in easy word and how does "SUBMENU" (did he > mean FL_SUBMENU ? ) in flags does that? SUBMENU might have been the old xforms name for what is now called FL_SUBMENU, so yes, most likely. > Also I could'nt understand what's use of flag FL_SUBMENU_POINTER? . Please > teach with an easy example? I've never needed it, but I *think* it's a way to graft a menu hierarchy several times in a single menu structure. So for instance, if you want a menu to look like: Operations |--> Integer | |--> Add | |--> Subtract | |--> Multiply | |--> Float | |--> Add | |--> Subtract | |--> Multiply | |--> Vector | |--> Add | |--> Subtract | |--> Multiply ..it sounds like you could make a single array of the Add/Subtract/Multiply items, and then using FL_SUBMENU_POINTER, refer to that in each of the Integer/Float/Vector submenu items. Kind of like a symbolic link, it sounds like, using the userdata as the pointer to the menu hierarchy. _______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk