DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: http://www.fltk.org/str.php?L2026
Version: 1.3-current
When a FL_NORMAL_BUTTON is configured as FL_WHEN_CHANGED, short cuts are
ignored.
I have attached a patch which fixes this problem and have tested it with
my application on Windows. The only issue as far as the patch goes, is
the case where you hold the short cut key down and also press the GUI
button at the same time. When you release the short cut key the GUI goes
inactive even though you still are pressing the GUI. I may try to fix
this as well but it involves code that affects other button type
combinations as well and I did not want to risk breaking anything, as I do
not use or necessarily understand all of the intricacies.
Link: http://www.fltk.org/str.php?L2026
Version: 1.3-current
Index: Fl_Button.cxx
===================================================================
--- Fl_Button.cxx (revision 6173)
+++ Fl_Button.cxx (working copy)
@@ -125,6 +125,14 @@
value(!value());
set_changed();
if (when() & FL_WHEN_CHANGED) do_callback();
+ }
+ else if ( (type() == FL_NORMAL_BUTTON) && when()&FL_WHEN_CHANGED) {
+ // Not already active by GUI push
+ if ( !value_ ) {
+ value_ = !oldval;
+ set_changed();
+ do_callback();
+ }
} else if (when() & FL_WHEN_RELEASE) do_callback();
return 1;
case FL_FOCUS :
@@ -154,6 +162,21 @@
if (when() & FL_WHEN_RELEASE) do_callback();
return 1;
}
+ return 0;
+
+ case FL_KEYUP :
+ if ( (type() == FL_NORMAL_BUTTON) && when()&FL_WHEN_CHANGED) {
+ if (!(shortcut() ? Fl::test_shortcut(shortcut()) : test_shortcut())) {
+ return 0;
+ }
+ else if ( value_ ) {
+ value(oldval);
+ set_changed();
+ do_callback();
+ return 1;
+ }
+ }
+
default:
return 0;
}
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs