Daniel Gollas wrote:
> Thanks all for the replies, I guess it's a common problem.
> Anyway, I will also submit a bug/feature request for a solution.
This might be the easy answer:
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Menu_Bar.H>
//
// Demonstrate how to add pathnames as menu items
// erco 12/10/07
//
int main() {
Fl_Window *win = new Fl_Window(400,400);
Fl_Menu_Bar *menu = new Fl_Menu_Bar(0,0,400,25);
menu->add("File/Open");
{
int i;
Fl_Menu_Item *m;
i = menu->add("File/Open Recent/x"); m = (Fl_Menu_Item*)menu->menu();
m[i].label("/some/path/to/foo.ext");
i = menu->add("File/Open Recent/x"); m = (Fl_Menu_Item*)menu->menu();
m[i].label("/some/path/to/bar.ext");
i = menu->add("File/Open Recent/x"); m = (Fl_Menu_Item*)menu->menu();
m[i].label("/some/path/to/blah.ext");
}
win->end();
win->show();
return(Fl::run());
}
Just add() the menu item, using "x" in place of the label that
might contain slashes, then change the label() of the returned menu item
immediately afterwards.
I think it's only the add() method that's interpreting the slashes
as submenus, so if you change the label after add()ing the item,
that should be safe.
If that works, you can probably make that into a function.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk