# To subscribers of the xforms list from "T.C. Zhao" <email@example.com> :
--- firstname.lastname@example.org wrote:
> # To subscribers of the xforms list from email@example.com :
> The following program is a modified version of one
> of the example programs. It creates a form with
> one input field with a filter, and maximum characters
> set to 8.
> I've noticed that if the field has the maximum characters (8)
> entered, and if part of that field is selected, the next
> keystroke causes an incorrect replacement of the selected
> region. In fact, it requires two keystrokes to change
> the field. It works fine if the field has less than
> the maximum characters.
> Also, why is the filter called twice for each keystroke.
If you set return to FL_RETURN_END, it should be
called only once. The filter parameter old==new and newc==0
signifies the end of input. FL_RETURN_ALWAYS
requires the end of input to happen on every keystroke.
> Am I doing something incorrectly?
No. It was a real bug in xforms. The string length
was computed before the selection was deleted, causing
the maxchar check to fail and short-circuited the redraw.
> FL_INPUTVALIDATOR hex_filter(FL_OBJECT *ob, const char *old, const
> *cur, int c)
> printf("old (%s) new (%s) (%c) (%x)\n", old, cur, c,
> if (isxdigit(c))
BTW, this is a wrong prototype. Your filter function
should be decleared as int hex_filter().
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
To unsubscribe, send the message "unsubscribe" to
firstname.lastname@example.org or see
XForms Home Page: http://world.std.com/~xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/
This archive was generated by hypermail 2b29 : Sat Jun 10 2000 - 22:26:18 EDT