From 666d0412243ce671dc53ddeb3a29b5c866f5066b Mon Sep 17 00:00:00 2001 From: Bill Spitzak Date: Tue, 22 Feb 2000 00:56:53 +0000 Subject: Fixed the changes I made yesterday so that int/float input fields do not eat Alt+letter key combinations. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1009 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- documentation/Fl_Input.html | 6 +++--- src/Fl_Input.cxx | 44 +++++++++++++++++++------------------------- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/documentation/Fl_Input.html b/documentation/Fl_Input.html index d6af54f69..87b3c9421 100644 --- a/documentation/Fl_Input.html +++ b/documentation/Fl_Input.html @@ -26,7 +26,7 @@ a white background. The text may contain any characters (even 0), and will correctly display anything, using ^X notation for unprintable control characters and \nnn notation for unprintable characters with the high bit set. It assummes the font can draw any characters in the -ISO8859-1 character set. +ISO-8859-1 character set.

@@ -38,8 +38,8 @@ ISO8859-1 character set. diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index ab6947eb5..cef2a092f 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Input.cxx,v 1.10.2.6 2000/02/21 10:29:58 bill Exp $" +// "$Id: Fl_Input.cxx,v 1.10.2.7 2000/02/22 00:56:53 bill Exp $" // // Input widget for the Fast Light Tool Kit (FLTK). // @@ -62,32 +62,26 @@ int Fl_Input::handle_key() { char ascii = Fl::event_text()[0]; - // Insert characters into numeric fields after checking for legality: - if (type() == FL_FLOAT_INPUT) { + int del; + if (Fl::compose(del)) { - // This could be improved to make sure characters are only inserted - // at legal positions... - if (ascii && strchr("0123456789.eE+-", ascii)) - return replace(position(), mark(), &ascii, 1); - - } else if (type() == FL_INT_INPUT) { - - // Somewhat more complicated so that "0x12ab" hex can be typed - if (!position() && (ascii == '+' || ascii == '-') - || (ascii >= '0' && ascii <= '9') - || (position()==1 && index(0)=='0' && (ascii=='x' || ascii == 'X')) - || (position()>1 && index(0)=='0' && (index(1)=='x'||index(1)=='X') - && (ascii>='A'&& ascii<='F' || ascii>='a'&& ascii<='f'))) - return replace(position(), mark(), &ascii, 1); - - } else { - // normal input fields use compose processing: - int del; - if (Fl::compose(del)) { - replace(position(), del ? position()-del : mark(), - Fl::event_text(), Fl::event_length()); + // Insert characters into numeric fields after checking for legality: + if (type() == FL_FLOAT_INPUT || type() == FL_INT_INPUT) { + Fl::compose_reset(); // ignore any foreign letters... + // This is complex to allow "0xff12" hex to be typed: + if (!position() && (ascii == '+' || ascii == '-') || + (ascii >= '0' && ascii <= '9') || + (position()==1 && index(0)=='0' && (ascii=='x' || ascii == 'X')) || + (position()>1 && index(0)=='0' && (index(1)=='x'||index(1)=='X') + && (ascii>='A'&& ascii<='F' || ascii>='a'&& ascii<='f')) || + type()==FL_FLOAT_INPUT && ascii && strchr(".eE+-", ascii)) + replace(position(), mark(), &ascii, 1); return 1; } + + replace(position(), del ? position()-del : mark(), + Fl::event_text(), Fl::event_length()); + return 1; } switch (Fl::event_key()) { @@ -259,5 +253,5 @@ Fl_Input::Fl_Input(int x, int y, int w, int h, const char *l) } // -// End of "$Id: Fl_Input.cxx,v 1.10.2.6 2000/02/21 10:29:58 bill Exp $". +// End of "$Id: Fl_Input.cxx,v 1.10.2.7 2000/02/22 00:56:53 bill Exp $". // -- cgit v1.2.3
Mouse button 2Insert the clipboard at -the point clicked. You can also select a region to replace with the -clipboard by selecting a region with mouse button 2. +the point clicked. You can also select a region and replace it with the +clipboard by selecting the region with mouse button 2.
Mouse button 3Currently acts like button 1.