michael sephton a écrit :

> I have done an example of this here: 
> http://members.optusnet.com.au/msephton/fltk/dynmen.zip
> in case it helps.
> It has the same menu structure as you suggest, and the recents menu is 
> populated by the user clicking on the open button, which spawns a 
> file_chooser dialog, and whichever file the user chooses, is added to 
> the recents submenu.
> 

Thanx a lot for your example!
Now all is clear. I look at your program and at the source code 
_generated by fluid_.

You declare several menu item (Fl_Menu_Items[]), and for one of them, 
you set a FL_SUBMENU_POINTER , and a user_data which means in this case 
a pointer to a submenu...

But in fluid, _my error_ is that I create "Recent" as a "Submenu". In 
such a case, fluid generate a sequence like :

   {"Recent", 0,  0, 0, 64, FL_NORMAL_LABEL, 2, 12, 0},
   {0,0,0,0,0,0,0,0,0},   // the end of the submenu
   {"Save", 0,  (Fl_Callback*)save, 0, 128, FL_NORMAL_LABEL, 2, 12, 0},

... giving me unexpected results. Now, I decalre "recent" as a normal 
Fl_Menu_Item =>

   {"Recent", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
   {"Save", 0,  (Fl_Callback*)save, 0, 128, FL_NORMAL_LABEL, 2, 12, 0},

In my code, I declare a pointer to "Recent" and I make :
last->flags |= FL_SUBMENU_POINTER;
last->user_data= a_function_giving_a_dynamic_array_of_Fl_Menu_Items();

And that works.





_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to