[comp.windows.x.motif] XmForm help

lindholm@ucs.ubc.ca (George Lindholm) (06/27/91)

I trying to get XmForm to accept a particular layout that I want between
a ScrolledWindow and a PushButton but when I define the layout XmForm complains
and produces a scrambled layout. Here's the layout that I want:

+-------------------XmForm--------------------------+
|                                                   |
|+---------------------+                            |
||                     |                            |
||                     |                            |
|| ScrolledWindow      |       other widgets        |
||                     |                            |
||                     |                            |
|+---------------------+                            |
|                +-----+                            |
|                |PushB|                            |
|                +-----+                            |
+---------------------------------------------------+

The constraint that I want is that the bottom of the ScrolledWindow is to
tied to the top of the PushButton and that the right side of the PushButton
is to be tied to the right side of the ScrolledWindow.

When I use the following code:

   n = 0;
   XtSetArg(args[n], XmNleftAttachment,  (XtArgVal) XmATTACH_FORM); n++;
   XtSetArg(args[n], XmNrightAttachment, (XtArgVal) XmATTACH_POSITION); n++;
   XtSetArg(args[n], XmNrightPosition,   (XtArgVal) 50); n++;
   viewport[file1] = XmCreateScrolledWindow(outer_widget, "view1", args, n);
   . . . 
   n = 0;
   XtSetArg(args[n], XmNtopAttachment,    (XtArgVal) XmATTACH_NONE); n++;
   XtSetArg(args[n], XmNleftAttachment,   (XtArgVal) XmATTACH_NONE); n++;
   XtSetArg(args[n], XmNbottomAttachment, (XtArgVal) XmATTACH_FORM); n++;
   scan_widget[file1] = XmCreatePushButton(outer_widget, "scan1", args, n);
   XtVaSetValues(viewport[file1],
		 XmNbottomAttachment, (XtArgVal) XmATTACH_WIDGET,
		 XmNbottomWidget,     (XtArgVal) scan_widget[file1],
		 NULL);
   XtManageChild(viewport[file1]);

   XtVaSetValues(scan_widget[file1],
		 XmNrightAttachment, (XtArgVal) XmATTACH_OPPOSITE_WIDGET,
		 XmNrightWidget,     (XtArgVal) viewport[file1],
		 NULL);
   XtManageChild(scan_widget[file1]);

I get:
Warning:
    Name: form
    Class: XmForm
    Circular dependency in Form children.

Where is the circular dependency? And can I do what I want with XmForm?? Thanks
-- 
George Lindholm                                   phone:    (604) 822-4375
University Computing Services, UBC                fax:      (604) 822-5116
6356 Agricultural Road, Vancouver, B.C., Canada   internet: lindholm@ucs.ubc.ca
V6T 1Z2                                           bitnet:   USERGNL@UBCMTSG

rfp@uucs1.UUCP (rfp) (06/28/91)

In article <1991Jun26.234931.12224@unixg.ubc.ca> lindholm@ucs.ubc.ca (George Lindholm) writes:
>I trying to get XmForm to accept a particular layout that I want between
>a ScrolledWindow and a PushButton but when I define the layout XmForm complains
>and produces a scrambled layout.

This is apparently a common error, as I struggled over the same thing about
a week ago while learning Motif.  Turns out that the widget ID you get from
the CreateScrolledWindow convenience function is the inner child -- but
what you want to work with is the parent.  Just replace viewport[..] with
XtParent(viewport[..]) and so forth.


-- 
Roger F. Powell
UUCS inc.   Phoenix, Az
ncar!noao!asuvax!hrc!uucs1!rfp	sun!sunburn!gtx!uucs1!rfp