Re: XForms: Getting info from objects in callbacks.

From: Steve Lamont (spl@ncmir.ucsd.edu)
Date: Thu Jul 20 2000 - 17:31:23 EDT

  • Next message: Jon Guerin: "Re: XForms: Getting info from objects in callbacks."

    # To subscribers of the xforms list from Steve Lamont <spl@ncmir.ucsd.edu> :

    > I have 2 text fields and a button. I need it so that the button, when
    > pressed, does an atoi on those 2 text fields. ...
    > [...]
    > void CB_Btn_Routine(...)
    > {
    > char *f1, *f2;
    > f1 = atoi(fl_get_input(field1)); // <- How do I get address/etc of
    > this field?

    If your Input objects are in the same Form as the Button object, and
    you used `fdesign' to create the form specification[1], then you can do

            void your_callback( FL_OBJECT *obj, long parm )

            {

                FD_your_form_structure *fd_your_form_structure =
                    ( FD_your_form_structure *) obj->form->fdui;
                int f1;
                int f2;

                f1 = atoi( fl_get_input( fd_your_form_structure->field1 ) );
                f2 = atoi( fl_get_input( fd_your_form_structure->field2 ) );

                [...]

            }

    Each FL_OBJECT structure has a pointer member pointing back to the form
    which contains it and the FL_FORM structure has a pointer to the an
    object of type `FD_any', which can be cast to your form definition
    structure.

                                                            spl

    [1] If you didn't then things are a bit more complicated, depending on
    what data structures you chose to design to contain the description of
    the Form, however most folks just use `fdesign', I'd wager.
    _________________________________________________
    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 : Thu Jul 20 2000 - 13:32:53 EDT