[comp.windows.x.motif] PanedWindow resizing

webb@cow.melco.co.jp (webb) (06/04/91)

Problem 1:
I have an application where there is a row column widget containing
some Pushbuttons. I lay the Pushbuttons out with XmNorientation set
as XmHORIZONTAL. I want to be able to see all of the Pushbuttons at
the same time without having to adjust the sashes, and if the user
resizes the application, I want the PanedWindow to adjust the height
of it's pane so that all of the Pushbuttons remain in view. I have
tried lots of combinations of resource settings without success, can
anyone help ?

Problem 2:
After referring to the book "Application Environment Specification
(AES)  User Environment Volume" by OSF I thought that perhaps this
problem was due the panedWindow resource setting of XmNskipAdjust. The
manual says the following:

"XmNskipAdjust
	When set to True, the Boolean resource allows an application
to specify that the PanedWindow should not automatically resize this
pane."

Perhaps, I thought, this means that if XmNskipAdjust is set to False
the PanedWindow WILL automatically resize this pane. - No such luck !
The other strange thing is that if you do set XmNskipAdjust to False
you can't even manually resize the pane (let alone automatically).
The source code of my sample program follows. 
Using the sashes you can increase the height of the panes containing
the Pushbuttons, but you can't decrease it at all in the case of the
lower pane (The sash will not move down). In the case of the upper
pane, as you try to decrease the 
height of the lower pane, the height of the upper pane increases,
but it's own sash has no effect (The sash will not move up).
Of course the original problem of automatic resizing still remains. Is
there a bug in my program, or Motif, or is skipAdjust just not a very
useful resource ? I would be very grateful if anyone can give me an
answer to any, or both of these problems.

Many thanks,

Mark J. Webb ( webb@mickey.cow.melco.co.jp )

#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>

#include <Xm/Xm.h>
#include <Xm/PanedW.h>
#include <Xm/Label.h>
#include <Xm/RowColumn.h>
#include <Xm/Text.h>
#include <Xm/PushB.h>

main(argc,argv)
int argc;
char *argv[];
{
    Widget toplevel,pane,row1,row2,label,text;
    Arg args[10];
    int i = 0, j = 0;

    toplevel = XtInitialize("sample","Sample",NULL,NULL,&argc,argv);

    pane = XtCreateManagedWidget("pane", xmPanedWindowWidgetClass, toplevel,
                                 NULL, 0);

    label = XtCreateManagedWidget("sample program", xmLabelWidgetClass, pane,
                                  NULL, 0);

    XtSetArg(args[i], XmNorientation, XmHORIZONTAL); i++;
    XtSetArg(args[i], XmNskipAdjust, True); i++;
    row1 = XtCreateManagedWidget("row1", xmRowColumnWidgetClass, pane, args, i);
    i = 0;

    for(j=0; j < 10; j++){
    	char name[20];
    	sprintf(name, "button %d", j);
    	XtCreateManagedWidget(name, xmPushButtonWidgetClass, row1, NULL, 0);
    }

    XtSetArg(args[i], XmNheight, 300); i++;
    XtSetArg(args[i], XmNwidth, 600); i++;
    XtSetArg(args[i], XmNeditMode, XmMULTI_LINE_EDIT); i++;
    text = XtCreateManagedWidget("text", xmTextWidgetClass, pane, args, i);
    i = 0;

    XtSetArg(args[i], XmNorientation, XmHORIZONTAL); i++;
    XtSetArg(args[i], XmNskipAdjust, True); i++;
    row2 = XtCreateManagedWidget("row2", xmRowColumnWidgetClass, pane, args, i);
    i = 0;

    for(j=0; j < 10; j++){
    	char name[20];
    	sprintf(name, "button %d", j);
    	XtCreateManagedWidget(name, xmPushButtonWidgetClass, row2, NULL, 0);
    }

    XtRealizeWidget(toplevel);
    XtMainLoop();
}