From 8327071ab0068f0f65ea176bc03f51dedb061254 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Wed, 13 Jan 1999 15:47:27 +0000 Subject: Fixes from Bill: - Fixed redraw bug in fl_color_chooser(). - Fl_Value_Input will now accept hexadecimal numbers. git-svn-id: file:///fltk/svn/fltk/trunk@210 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Input.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/Fl_Input.cxx') diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index f2bdd0d08..15980f348 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Input.cxx,v 1.8 1999/01/07 19:17:21 mike Exp $" +// "$Id: Fl_Input.cxx,v 1.9 1999/01/13 15:47:27 mike Exp $" // // Input widget for the Fast Light Tool Kit (FLTK). // @@ -259,7 +259,13 @@ int Fl_Input::handle_key() { if (type() == FL_FLOAT_INPUT) { if (!strchr("0123456789.eE+-", key)) return 0; } else if (type() == FL_INT_INPUT) { - if (!strchr("0123456789+-", key)) return 0; + if (!position() && (key == '+' || key == '-')); + else if (key >= '0' && key <= '9'); + // we allow 0xabc style hex numbers to be typed: + else if (position()==1 && index(0)=='0' && (key == 'x' || key == 'X')); + else if (position()>1 && index(0)=='0' && (index(1)=='x'||index(1)=='X') + && (key>='A'&& key<='F' || key>='a'&& key<='f')); + else return 0; } return replace(position(), mark(), Fl::event_text(), Fl::event_length()); @@ -323,5 +329,5 @@ Fl_Input::Fl_Input(int x, int y, int w, int h, const char *l) } // -// End of "$Id: Fl_Input.cxx,v 1.8 1999/01/07 19:17:21 mike Exp $". +// End of "$Id: Fl_Input.cxx,v 1.9 1999/01/13 15:47:27 mike Exp $". // -- cgit v1.2.3