From 8a64710a17df1c164d4bd6b3778b118de010b7f8 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sun, 29 Oct 2006 12:34:14 +0000 Subject: 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 --- CHANGES | 2 ++ FL/Fl_Spinner.H | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/CHANGES b/CHANGES index 5e7239730..527386132 100644 --- a/CHANGES +++ b/CHANGES @@ -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 diff --git a/FL/Fl_Spinner.H b/FL/Fl_Spinner.H index b84a20b9e..662ae8cb8 100644 --- a/FL/Fl_Spinner.H +++ b/FL/Fl_Spinner.H @@ -32,6 +32,7 @@ // Include necessary headers... // +# include # include # include # include @@ -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_); } -- cgit v1.2.3