that's quite another approach than mine - but works perfect. Thanks for that!
In the meantime I found out how to work with add:
int n = 3;
Fl_Menu_Item *pop = new Fl_Menu_Item[n];
pop->add( "First item", 0, 0, 0, 0 );
pop->add( "Second item", 0, 0, 0, 0 );
..
pop->popup( 10, 10, 0, 0, 0 );
Apparently add() may be used only after having allocated an array of
Fl_Menu_Items whose size is one more than the number of Items to be added.
I think I'll be using Fl_Menu_Button.
Thanks again and bye
testalucida
>
> > your guess concerning a popup menu is right.
> > I examined Greg's Menu_Bar examples, but couldn't find=20
> > anything that suits my needs - he describes how to access=20
> > Fl_Menu_Items in a menu, but not how to dynamically add them.
> > I'm sharing your view, that I'm using add() in the wrong way=20
> > - but which would be the right one?
>
> Um, I don't know; can't be that complicated... Does this help?
>
> ------------------------
> #include <FL/Fl.H>
> #include <FL/Fl_Double_Window.H>
> #include <FL/Fl_Menu_Button.H>
> #include <FL/Fl_Button.H>
>
> #include <stdio.h>
>
> Fl_Double_Window *main_win=3D(Fl_Double_Window *)0;
> Fl_Menu_Button *pop3=3D(Fl_Menu_Button *)0;
> Fl_Button *quit_bt=3D(Fl_Button *)0;
>
> static void cb_quit_bt(Fl_Button*, void*) {
> main_win->hide();
> }
>
> static void cb_hello(Fl_Button*, void*) {
> puts("Hello World!"); fflush(stdout);
> }
>
> int main(int argc, char **argv) {
> main_win =3D new Fl_Double_Window(368, 333, "Popup Menu Test");
> main_win->begin();
>
> pop3 =3D new Fl_Menu_Button(0, 0, 299, 303, "&popup");
> pop3->type(Fl_Menu_Button::POPUP3);
> pop3->box(FL_THIN_UP_BOX);
> pop3->add("line 1");
> pop3->add("line 2");
> pop3->add("Hello", 0, (Fl_Callback*)cb_hello);
> pop3->add("Quit", 0, (Fl_Callback*)cb_quit_bt);
>
> quit_bt =3D new Fl_Button(299, 303, 64, 26, "Quit");
> quit_bt->callback((Fl_Callback*)cb_quit_bt);
>
> main_win->end();
> main_win->show(argc, argv);
> return Fl::run();
> }
> ------------------------
>
>
> SELEX Galileo Ltd
> Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS=
> 14 3EL
> A company registered in England & Wales. Company no. 02426132
> ********************************************************************
> This email and any attachments are confidential to the intended
> recipient and may also be privileged. If you are not the intended
> recipient please delete it from your system and notify the sender.
> You should not copy it or use it for any purpose nor disclose or
> distribute its contents to any other person.
> ********************************************************************
>
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk