cwpbl wrote:
> Hi everibody,
> 
> I try to make a menu wich include a submenu. But this submenu must be 
> dynamic. For instance
> 
> File
>     Open
>     Recents
>         File1.cpp
>         test.txt
>     Save
> ...
> 
> The submenu "recents" depends on the context. I try to name my menu 
> "Recents", and the to set "flags" and "user_data" fields but the submenu 
> remains void. I point out that my main menu is build with fluid.
> 
> Any idea ?
> 

My experience is based on fltk1.1x only and I haven't tried using fluid. 
  I think to create a dynamic menu or submenu, you can create a dynamic 
container of Fl_Menu_Item objects.  Then you use the FL_SUBMENU_POINTER 
flag for the Recents Fl_Menu_Item, and include a pointer to the array 
managed by the dynamic container, in the user data of the Recents 
Fl_Menu_Item.  It is important if the dynamic container is resized, that 
the pointer to its array in the user data is updated, otherwise it will 
point to an obsolete location.

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.

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

Reply via email to