Re: XForms: Test if input object has changed

From: T.C. Zhao (tc_zhao@yahoo.com)
Date: Wed Feb 09 2000 - 23:27:25 EST

  • Next message: T.C. Zhao: "Re: XForms: Test if input object has changed"

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

    The behavior you're describing sounds like v0.88 (
    input callback not called when a form is hidden). In any
    case, registering a filter probably is the cleanest way
    to go about it if you use the v_ldata field in the object
    structure:
      filter_used_as_a_change_check(ob, oldbuf, newbuf, key)
      {
            ob->u_ldata = (ob->u_ldata || key != 0);
            return FL_VALID;
      }

    In your input callback
       input_callback(ob, data)
       {
            ob->u_ldata = 0;
       }

    This way, the status of the input field "hangs" on the object
    itself, and I would consider this clean.

    --- Clive A Stubbings <xforms
    @vjet.demon.co.uk> wrote:
    > # To subscribers of the xforms list from Clive A Stubbings
    > <xforms@vjet.demon.co.uk> :
    >
    > Hi,
    >
    > Does anyone know of a clean way to test whether text in an input
    > object has been changed since the object was last set or its
    > callback was last called?
    >
    > I need this to "work round" a quirk in the way FL_RETURN_CHANGED
    > works.
    > If you use fl_set_input_return(ob, FL_RETURN_CHANGED) on a Multiline
    > input object, the callback will be called when focus changes to
    > another
    > input object on the same form. However the callback is not called
    > when
    > you press a button or do some other action or focus on an input to
    > another form. So.. if you flip between tabs on a tabbed form, or
    > close a
    > form, the callback still isn't called. Now its easy to check whether
    > the
    > current focus object is an input object using
    >
    > inputobj = fl_get_focus_object(form);
    > if (inputobj && (inputobj->objclass == FL_INPUT)) {
    >
    > but what I can't see is how to then check whether the object has
    > been changed..
    >
    > I guess there are various ways to work round this like setting a
    > callback to occur on every character typed. But I don't really want
    > to
    > read and process on every character. I suppose I could set a flag,
    > but
    > there are a number of objects spread over a number of forms and that
    > would take a lot of managing..
    >
    > A simple
    >
    > int fl_input_has_changed(FL_OBJECT ob);
    >
    > function would be ideal..
    >
    > I have a REALLY dirty way of doing this, but it is not portable
    > across
    > different versions of the library because it relies on knowing the
    > internal structure of the "spec" field in an input object.. (which is
    > not in the headers so I deduced the critical bit empirically.. ;-)
    > There
    > seems to be a field there that contains exactly this information (8th
    > int for what its worth).. I do not like this solution...
    >
    > Anyone know of any better way?
    >
    > Cheers
    > Clive
    >
    > _________________________________________________
    > 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/
    >
    >
    __________________________________________________
    Do You Yahoo!?
    Talk to your friends online with Yahoo! Messenger.
    http://im.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 : Wed Feb 09 2000 - 23:30:25 EST