diff options
Diffstat (limited to 'src/Fl_Spinner.cxx')
| -rw-r--r-- | src/Fl_Spinner.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Fl_Spinner.cxx b/src/Fl_Spinner.cxx index 220ac1698..3ef102a55 100644 --- a/src/Fl_Spinner.cxx +++ b/src/Fl_Spinner.cxx @@ -196,6 +196,24 @@ void Fl_Spinner::type(uchar v) { } +/** + Handles events of Fl_Spinner's embedded input widget. + + Works like Fl_Input::handle() but ignores FL_Up and FL_Down keys + so they can be handled by the parent widget (Fl_Spinner). +*/ +int Fl_Spinner::Fl_Spinner_Input::handle(int event) { + if (event == FL_KEYBOARD) { + const int key = Fl::event_key(); + if (key == FL_Up || key == FL_Down) { + Fl_Input::handle(FL_UNFOCUS); // sets and potentially clips the input value + return 0; + } + } + return Fl_Input::handle(event); +} + + // // End of "$Id$". // |
