XForms: call_object_callback difficulties

From: Hugh Gibson (hugh@mrao.cam.ac.uk)
Date: Wed Feb 02 2000 - 15:24:20 EST

  • Next message: Steve Lamont: "Re: XForms: call_object_callback difficulties"

    # To subscribers of the xforms list from Hugh Gibson <hugh@mrao.cam.ac.uk> :

            I'm using the
    fl_call_object_callback(FL_OBJECT *ob)
    routine in my code without problems (Linux xforms 0.89 and Fdesigner)

            However, I have several objects (like sliders) which share the
    SAME callback function, but with different data parameters to identify
    which slider has been tweaked.

    e.g. def

    FL_OBJECT *vslider[16];

                   OK, this all works fine....

    Now, from a different part of the programme, I want to use the
    fl_call_object_callback(FL_OBJECT *ob) to tweak the slider,
    but now, I need to specify the passed data too, and there is no
    room for the data entry in the fl_call_object call.

    I have found that I can call the callback function directly... e.g.

    set_voltage(vslider, 3); (set_voltage is the callback, and
                                  vslider is the xforms object)

    the compiler understandably always throws out....

    warning: passing arg 1 of `set_voltage' from incompatible pointer type

    (i.e. it's complaining about the xforms object vslider..but it works!)

    Is there a nice way to do this?

       Finally, may I add one minor suggestion to the documentation..
    It would be handy to document how to set up FDesign
    so that you can isolate the FDesign bits from the callbacks, so that
    when you modify the copied callback code, you don't lose all your
    precious filled-in callbacks when you decide to
    shift a slider or box etc.. around.

    fdesign myprog -altformat -main -callback -I myheader.h

    using your own header with

    #include "myglobals.h" // stuff relating to the 'glue' of the programme
    #include "forms.h" // xforms variables (straight from FDesign!)
    #include "whatever_you_need.h"

    then renaming the cb.c and main.c so FDesigner doesn't trample on

    A simpler demo Makefile would have been very handy too.

          After you have this cracked, it's a real joy to use.
                Cheers, Hugh Gibson

    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 02 2000 - 15:25:05 EST