Right-click is POPUP3 or 3.
> I have a Fl_Check_Button which has a label, I want some menu to pop up when I right click the label
But I see the problem. Your sample works fine if you create a Fl_Box with a label to be right-clicked over. A Fl_Check_Button, on the other hand,
is grabbing all mouse events, and the Fl_Menu_Button is never activated.
The modified version below works by making the check button really narrow and faking up a label via Fl_Box. The Fl_Menu_Button works
now because Fl_Box isn't grabbing mouse events.
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Menu_Button.H>
#include <FL/Fl_Check_Button.H>
#include <FL/Fl_Box.H>
Fl_Menu_Item menu_menu[] = {
{"item", 0, 0, 0, 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0}
};
int main(int argc, char **argv) {
Fl_Double_Window* w;
{ Fl_Double_Window* o = new Fl_Double_Window(120, 100);
w = o; if (w) {/* empty */}
{ Fl_Menu_Button* o = new Fl_Menu_Button(25, 25, 69, 20, "menu");
o->type(Fl_Menu_Button::POPUP3);
o->menu(menu_menu);
} // Fl_Menu_Button* o
auto cb = new Fl_Check_Button(20,25,20,20);
auto bx = new Fl_Box(25,25,100,20,"CB Label");
o->end();
} // Fl_Double_Window* o
w->show(argc, argv);
return Fl::run();
}
Someone smarter than me might know how to create a Fl_Check_Button which doesn't grab the right mouse button.