On 09/10/11 11:47, Greg Ercolano wrote:
> On 09/10/11 10:39, corvid wrote:
>>
>> With 2.0, pressing Enter triggers a button.
>> In 1.3, only Space works.
>
> I believe Fl_Return_Button is what you'd want to use in 1.3.x
> to have the enter key trigger a button.
I should add: Fl_Return_Button will trigger even if it doesn't
have focus. So if the Enter key isn't already being handled
by something else (like an Fl_Multiline_Input widget), this button
will take the event for itself.
Otherwise, for focus-only oriented behavior, besides deriving
your own widget (eg. MyButton) that handles this, I suppose
a method could be added to Fl_Button, with 'space' being the default.
So for instance, something like:
button->trigger_key_clear(); // clear previous trigger keys,
including 'space'
button->trigger_key_add(FL_Enter); // add regular enter key
button->trigger_key_add(FL_KP_Enter); // add keypad enter key
..this way both enter keys can trigger the button.
Perhaps too, this could be a global preference, the way
we currently have Fl::scrollbar_size() to set things globally,
and Fl_<SomeWidget>::scrollbar_size() to affect just one widget.
Or, if there's some agreement that 'space' is not the right
key anymore, and Enter is, then perhaps a petition to change.
(I'm almost sure that would break some existing apps though.)
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk