[comp.windows.x] A form widget as a compass

cso@organ.cis.ohio-state.edu (Conleth O'Connell) (03/06/90)

I know the subject line sounds strange but bear with me for a bit.  I
am trying to represent a compass, i.e., 

	north
west	here	east
	south

using a form widget with 4 command widgets (directions) and a label
widget (here) to allow a user to navigate through a data structure.
Actually performing the functions are fine, it is the look of the
compass that is disappointing.  Because of the way fform widgets
require the specification of children as relative to the upper/left
side neighbors, I start out with a ghost widget in the upper left hand
corner, so that I can specify north (the code segment for the
specification of the widgets follows).  So starting out everything
looks fine, but when west gets a new label I haven't found a way to
shift north so that it remains over here.  I have an update_compass()
routine that maintains the compass with respect to the data structure
and in there I try moving the north widget's X position to be the same
as here's X position but that doesn't work.  Any help/insight would be
greatly appreciated.  BTW, this is using X11R4 Xaw Widgets and Xt.

Thanks a bunch,
Con


   cnt = 0;
   XtSetArg(args[cnt], XtNfromVert,  NULL); cnt++;
   XtSetArg(args[cnt], XtNfromHoriz, NULL); cnt++;
   XtSetArg(args[cnt], XtNresizable, True); cnt++;
   XtSetArg(args[cnt], XtNborderWidth, 0);  cnt++;
   XtSetArg(args[cnt], XtNsensitive, False); cnt++;
   XtSetArg(args[cnt], XtNlabel, ""); cnt++;
   ghost = XtCreateManagedWidget("button", commandWidgetClass,
				 parent, args, cnt);

   cnt = 0;
   XtSetArg(args[cnt], XtNfromVert,  NULL); cnt++;
   XtSetArg(args[cnt], XtNfromHoriz, NULL); cnt++;
   XtSetArg(args[cnt], XtNresizable, True); cnt++;
   XtSetArg(args[cnt], XtNlabel, ""); cnt++;
   north = XtCreateManagedWidget("button", commandWidgetClass,
				 parent, args, cnt);
   XtAddCallback(north, XtNcallback, compass_move, NULL);

   cnt = 0;
   XtSetArg(args[cnt], XtNresizable, True); cnt++;
   XtSetArg(args[cnt], XtNfromVert,  north); cnt++;
   XtSetArg(args[cnt], XtNfromHoriz, NULL); cnt++;
   XtSetArg(args[cnt], XtNlabel, ""); cnt++;
   west  = XtCreateManagedWidget("button", commandWidgetClass,
				 parent, args, cnt);
   XtAddCallback(west, XtNcallback, compass_move, NULL);
   
   cnt = 0;
   XtSetArg(args[cnt], XtNresizable, True); cnt++;
   XtSetArg(args[cnt], XtNfromVert,  north); cnt++;
   XtSetArg(args[cnt], XtNfromHoriz, west); cnt++;
   XtSetArg(args[cnt], XtNlabel, ""); cnt++;
   here  = XtCreateManagedWidget("label", labelWidgetClass,
				 parent, args, cnt);
   
   cnt = 0;
   XtSetArg(args[cnt], XtNresizable, True); cnt++;
   XtSetArg(args[cnt], XtNfromVert,  here); cnt++;
   XtSetArg(args[cnt], XtNfromHoriz, west); cnt++;
   XtSetArg(args[cnt], XtNlabel, ""); cnt++;
   south = XtCreateManagedWidget("button", commandWidgetClass,
				 parent, args, cnt);
   XtAddCallback(south, XtNcallback, compass_move, NULL);
   
   cnt = 0;
   XtSetArg(args[cnt], XtNresizable, True); cnt++;
   XtSetArg(args[cnt], XtNfromVert,  north); cnt++;
   XtSetArg(args[cnt], XtNfromHoriz, here); cnt++;
   XtSetArg(args[cnt], XtNlabel, ""); cnt++;
   east  = XtCreateManagedWidget("button", commandWidgetClass,
				 parent, args, cnt);
   XtAddCallback(east, XtNcallback, compass_move, NULL);


-=-
Conleth S. O'Connell Jr. Department of Computer and Information Science
				  The Ohio State University
cso@cis.ohio-state.edu	  2036 Neil Ave., Columbus, OH USA 43210-1277