Fl_Spinner did not handle the arrow keys properly (STR #1476)

FL/Fl_Spinner.H:
    - Add Fl_Spinner::handle() method to handle arrow key and
      focus events.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5530 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2006-10-29 12:34:14 +00:00
parent c0664eefcd
commit 8a64710a17
2 changed files with 24 additions and 0 deletions

View File

@ -1,5 +1,7 @@
CHANGES IN FLTK 1.1.8
- Fl_Spinner did not handle the arrow keys properly (STR
#1476)
- Fl_File_Browser did not calculate the width of
directory items correctly (STR #1470)
- Fl_Pack incorrectly started widgets at an offset of 1/2

View File

@ -32,6 +32,7 @@
// Include necessary headers...
//
# include <FL/Enumerations.H>
# include <FL/Fl_Group.H>
# include <FL/Fl_Input.H>
# include <FL/Fl_Repeat_Button.H>
@ -141,6 +142,27 @@ class Fl_Spinner : public Fl_Group
const char *format() { return (format_); }
void format(const char *f) { format_ = f; update(); }
int handle(int event) {
switch (event) {
case FL_KEYDOWN :
case FL_SHORTCUT :
if (Fl::event_key() == FL_Up) {
up_button_.do_callback();
return 1;
} else if (Fl::event_key() == FL_Down) {
down_button_.do_callback();
return 1;
} else return 0;
case FL_FOCUS :
if (input_.take_focus()) return 1;
else return 0;
}
return Fl_Group::handle(event);
}
// Speling mistaks retained for source compatibility...
double maxinum() const { return (maximum_); }
double maximum() const { return (maximum_); }