XForms: Test if input object has changed

From: Clive A Stubbings (xforms@vjet.demon.co.uk)
Date: Wed Feb 09 2000 - 19:09:52 EST

  • Next message: Steve Lamont: "Re: XForms: Test if input object has changed"

    # To subscribers of the xforms list from Clive A Stubbings <xforms@vjet.demon.co.uk> :


    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?


    To unsubscribe, send the message "unsubscribe" to
    xforms-request@bob.usuhs.mil 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 : Wed Feb 09 2000 - 19:16:29 EST