Re: XForms: fl_set_object_position

From: Steve Lamont (spl@szechuan.ucsd.edu)
Date: Wed Apr 19 2000 - 10:45:03 EDT

  • Next message: Jean-Marc Lasgouttes: "XForms: Support for Input Methods?"

    # To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

    > I am trying to move a group of objects to a new position at once with
    >
    > fl_set_object_position ( Light_controls, new_x, new_y);
    >
    > where Light_controls is a group defined with fl_bgn_group.

    The attributes which are controlled by Groups are pretty limited --
    you can hide or show a Group, set gravity, or set some other
    attributes, as well as Group a set of buttons into a radio button
    configuration.

    Since each Object in a Group has its own position, relative to the
    origin of the Form and not relative to the origin of the Group, which
    maintains no useful positional information, you can't reposition a
    group in the way you are attempting.

    You could cobble up something like

            fl_move_group_relative( FL_OBJECT *group, int delta_x, int delta_y )

            {

                FL_OBJECT *obj = group->next;

                while ( obj->class != FL_END_GROUP ) {

                    FL_Coord x;
                    FL_Coord y;

                    fl_get_object_position( obj, &x, &y );
                    fl_set_object_position( obj, x + delta_x, y + delta_y );

                    obj = obj->next;

                }

            }

    which would move the whole Group. This code hasn't been tested and it
    isn't bulletproof (no test for whether `*group' points to an Object of
    class FL_BEGIN_GROUP, for instance), but it's a good start.

                                                            spl
    _________________________________________________
    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 Apr 19 2000 - 10:51:45 EDT