Re: XForms: input fields

From: T.C. Zhao (tc_zhao@yahoo.com)
Date: Sat Jun 10 2000 - 22:21:57 EDT

  • Next message: T.C. Zhao: "Re: XForms: Bug report for fl_show_fselector(..)"

    # To subscribers of the xforms list from "T.C. Zhao" <tc_zhao@yahoo.com> :

    --- rob.carpenter@lmco.com wrote:
    > # To subscribers of the xforms list from rob.carpenter@lmco.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
    > char
    > *cur, int c)
    > {
    > printf("old (%s) new (%s) (%c) (%x)\n", old, cur, c,
    > c);fflush(stdout);
    > if (isxdigit(c))
    > return((FL_INPUTVALIDATOR)FL_VALID);
    > else
    > return((FL_INPUTVALIDATOR)(FL_INVALID|FL_RINGBELL));
    > }

    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!
    http://photos.yahoo.com
    _________________________________________________
    To unsubscribe, send the message "unsubscribe" to
    xforms-request@bob.usuhs.mil or see
    http://bob.usuhs.mil/mailserv/xforms.html
    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