> your guess concerning a popup menu is right.
> I examined Greg's Menu_Bar examples, but couldn't find
> anything that suits my needs - he describes how to access
> 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
> - 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=(Fl_Double_Window *)0;
Fl_Menu_Button *pop3=(Fl_Menu_Button *)0;
Fl_Button *quit_bt=(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 = new Fl_Double_Window(368, 333, "Popup Menu Test");
main_win->begin();
pop3 = 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 = 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 SS14
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