DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: http://www.fltk.org/str.php?L2610
Version: 1.3-feature
Here is a patch to add a new method to Fl_Menu_Button to allow popup at a
specific position in code, I made it to allow show popup menus in code
without using the mouse, and because the popup without arguments always
open at mouse position it's not usefull when working without a mouse.
Link: http://www.fltk.org/str.php?L2610
Version: 1.3-feature
Index: FL/Fl_Menu_Button.H
===================================================================
--- FL/Fl_Menu_Button.H (revision 8618)
+++ FL/Fl_Menu_Button.H (working copy)
@@ -76,6 +76,7 @@
};
int handle(int);
const Fl_Menu_Item* popup();
+ const Fl_Menu_Item* popup(int x, int y);
Fl_Menu_Button(int,int,int,int,const char * =0);
};
Index: src/Fl_Menu_Button.cxx
===================================================================
--- src/Fl_Menu_Button.cxx (revision 8618)
+++ src/Fl_Menu_Button.cxx (working copy)
@@ -55,12 +55,16 @@
or NULL if the user dismisses the menu.
*/
const Fl_Menu_Item* Fl_Menu_Button::popup() {
+ return popup(Fl::event_x(), Fl::event_y());
+}
+
+const Fl_Menu_Item* Fl_Menu_Button::popup(int px, int py) {
const Fl_Menu_Item* m;
pressed_menu_button_ = this;
redraw();
Fl_Widget_Tracker mb(this);
if (!box() || type()) {
- m = menu()->popup(Fl::event_x(), Fl::event_y(), label(), mvalue(), this);
+ m = menu()->popup(px, py, label(), mvalue(), this);
} else {
m = menu()->pulldown(x(), y(), w(), h(), 0, this);
}
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev