> > Question 2) To resolve above problem , I head of function Fl_Menu_Bar::add 
> > function, which adds menu items I guess?
>
>       That's what I prefer to use almost always.
>
> > but that leads me to another problem :
> >
> >         menubar =  new MenuBar(0, 0, this->w(), 30); //MenuBar is typedef 
> > of Fl_Menu_Bar
> >     menubar->add("File", FL_CTRL+'F',nullptr,this,FL_SUBMENU);
> >     menubar->add("Hola",...);
> >
> > Now how do I signal fltk that last call to add item is to be shown in 
> > "File" submenu (i.e "Hola" submenu of "File" submenu)
> >
> >     menubar->add("File/Hola",...); // this is good way to do it?
>
>       I would even skip the first add() there, and just use:
>
> menubar->add("File/Hola",...); // this is good way to do it?
>
>       This will create the File menu if it doesn't exist, and adds Hola to it.
>       So for instance:
>
> menubar =  new MenuBar(0, 0, this->w(), 30);
> menubar->add("File/Open",...);
> menubar->add("File/Save",...);
> menubar->add("File/Quit",...);
>
>       ..is a valid way to create a File menu with three items in it.
>
>       BTW, you don't need the FL_CTRL+'F' to open the file menu;
>       If you want the user to be able to open the File menu by hitting Alt-F
>       (which I think is the default), put an & in front of the 'F' in File,
>       and it will show up with an underline in front of it, giving the user
>       the visual hint the menu can be opened from the keyboard. Quoting the
>       docs for Fl_Menu_Bar:
>
> "Submenus will also pop up in response to shortcuts indicated by putting a 
> '&' character
>  in the name field of the menu item. If you put a '&' character in a 
> top-level "button"
>  then the shortcut picks it. The '&' character in submenus is ignored until 
> the menu is popped up. "
>
>       So eg:
>
> menubar->add("&File/Open",...);
> menubar->add("&File/Save",...);
> menubar->add("&File/Quit",...);

@Greg Ercolano

Quote from fltk 1.3.0 , 30.77.2.4 :

**int Fl Menu Item::add ( const char  mytext, int sc, Fl_Callback  cb, void  
data = 0, int myflags = 0 ) Adds an item.

The text is split at ’/’ characters to automatically produce submenus 
(actually a totally unnecessary feature as you can now add submenu titles 
directly by setting SUBMENU in the flags)**

As you can see fltk documentation calls '/' actually a totally unnecessary 
feature. Can you explain me above para in easy word and how does "SUBMENU" (did 
he mean FL_SUBMENU ? ) in flags does that?

Also I could'nt understand what's use of flag FL_SUBMENU_POINTER? . Please 
teach with an easy example?

Thanks a lot , I really appreciate the help :)
_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to