XForms: Walking forms

Joel Weiner (weiner@mcci-arl-va.com)
Mon, 14 Jul 1997 11:10:25 -0400

To subscribers of the xforms list from weiner@mcci-arl-va.com (Joel Weiner) :

I'm trying to implement a Rollup menu ala Corel Draw by toggling between
two menus. The first having the list of functions followed by an up arrow
the second just showing a down arrow.

The problem is that the menus "walk" down and to the right on the screen by
a value which seems to be the number of pixels of the top border and left
border.

The following snippet shows how the callback does this:

The u_vdata of the up arrow points to the rolled up menu, the u_vdata of the
down arrow points to the full form.

void my_callback( FL_OBJECT *obj, long data)
{
switch( data )
{
case 1: /* The up arrow of the full form is hit. */
/* Display origin of full menu. */
printf("1: before setting: %d, %d\n", obj->form->x, obj->form->y );

/* Set position of "rolled up" form to origin of full form. */
fl_set_form_position( ((FL_OBJECT *)obj->u_vdata)->form,
obj->form->x, obj->form->y );

/* Hide full form. */
fl_hide_form( obj->form );

/* Show rolled up form. */
fl_show_form(((FL_OBJECT *)obj->u_vdata)->form,FL_PLACE_POSITION,
FL_TRANSIENT,"BUS EDIT");
/* Display origin of rolled up form. */
printf("1: after show: %d, %d\n",
((FL_OBJECT *)obj->u_vdata)->form->x,
((FL_OBJECT *)obj->u_vdata)->form->y );
break;

case 2: /* The down arrow of the Rollup form is hit. */
/* Display origin of rolled up form. */
printf("2: before setting: %d, %d\n", obj->form->x, obj->form->y );

/* Set position of full form. */
fl_set_form_position( ((FL_OBJECT *)obj->u_vdata)->form,
obj->form->x, obj->form->y );

/* Hide rolled up form. */
fl_hide_form( obj->form );

/* Show full form. */
fl_show_form(((FL_OBJECT *)obj->u_vdata)->form,FL_PLACE_POSITION,
FL_TRANSIENT,"BUS EDIT");

/* Display origin of full form. */
printf("2: after show: %d, %d\n",
((FL_OBJECT *)obj->u_vdata)->form->x,
((FL_OBJECT *)obj->u_vdata)->form->y );
break;
}
}

The output of the above generates the following:
1: before setting: 464, 304
1: after show: 469, 330
2: before setting: 469, 330
2: after show: 474, 356
1: before setting: 474, 356
1: after show: 479, 382
2: before setting: 479, 382
2: after show: 484, 408
1: before setting: 484, 408
1: after show: 489, 434

Any ideas as to why the form displaces??
Thanks,
J. Weiner
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/