On Saturday 21 April 2007 08:51:07 Greg Ercolano wrote:
> > then right mouse button click on main window wont bring up the menu!?
>
> Missing win->begin() and win->end() for the inner window.
I omitted them because even with them result is the same.
The following:
--- Beginning ---
#include <fltk/Window.h>
#include <fltk/PopupMenu.h>
#include <fltk/Menu.h>
#include <fltk/Item.h>
#include <fltk/ask.h>
#include <fltk/events.h>
#include <fltk/run.h>
#include <stdlib.h>
using namespace fltk;
class MainWindow : public Window {
PopupMenu *menu;
Item *about_item, *exit_item;
Window *win;
static void cb_menu(Widget* w, void* d) {
if (((Menu*)w)->value() == 1)
exit(0);
message("FLTK");
}
public:
MainWindow(int w, int h, char *s = 0): Window(w, h, s) {
begin();
win = new Window(100, 100);
win->begin();
win->end();
menu = new PopupMenu(0, 0, w, h);
menu->type(PopupMenu::POPUP3);
menu->begin();
about_item = new Item("About clock");
exit_item = new Item("Exit clock");
menu->end();
menu->callback(cb_menu, this);
end();
color(12);
show();
win->show();
}
};
int main(int argc, char **argv) {
MainWindow win(200, 200, "Test");
return run();
}
--- End ---
wont bring up the menu on right mouse button click.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk