Good day, I've some confusions related to Fl_Menu_Bar and Fl_Menu_Items. I 
apologize for multiple question in one but they are trivial so I though to 
create only one question.

Question 1) This is code from fltk 1.3.0 documentation :
http://ideone.com/5dL7d

Now suppose I create some GUI class like :

class GUI : public Fl_Window
{
Fl_Menu_Items menuItems[10];
.....
}

Since array is part of class I can't initialize that array at declaration. so 
what's the best way to add items in that array?
e.g I don't want to do something like

  menuItems[0].callback_ = somefunc; or menuItems[0].callback(somefunc);
  menuItems[0].label("smack that!");
  ....
  ....

What's the idiom to do this?


Question 2) To resolve above problem , I head of function Fl_Menu_Bar::add 
function, which adds menu items I guess?

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?

Question 3) How to signal fltk that submenu has ended, now another menu begins? 
i.e analogues to {0} in Fl_Menu_Items's array or I don't need to do that when 
I'm using Fl_Menu_Items::add function?

Question 4) In the documentation Fl_Menu_Bar don't have any add member function 
, In actually it has when try to access it from object of it.

so I assume Fl_Menu_Bar is derived from Fl_Menu_Items? and so the following 
code is ok :

    Fl_Menu_Bar *menu = new Fl_Menu_Bar(...);
    Fl_Menu_Item *p;
    p = (Fl_Menu_Item*)menu->find_item(...);


I really appreciate the time and help of every user reading this (and for 
questions too not belonging to mine) and trying to answer them :)
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to