I'm flummoxed by the behaviour of the following test program. There is a
horizontal pane containing two scrolling widgets. I set the min/max pane size
for the left scroller and the min for the right scroller. When I resize
horizontally to increase the window size, I do not want the left scroller to
exceed its max pane size; essentially, I want the new horizontal space to be
added to the right scroller. However, what actually occurs is bizarre.

I sometimes see the left scroller increase in size beyond its maximum. And if I
make the window very large, the right scroller stops growing and empty space is
added on the right. I'm really hoping people don't say this is a bug in pane
and there is no workaround. 8-(

I believe I'm using motif 2.1 on SUN Solaris 8.

@plg2[1]% uname -a
SunOS plg2.math 5.8 Generic_117350-38 sun4u sparc SUNW,Sun-Fire-880

================================================== ===========================

#include
#include
#include
#include
#include
#include
#include
#include

#include
#include

void closeCB( Widget, void *, XmAnyCallbackStruct * ) {
exit( 0 );
}

int main( int argc, char *argv[] ) {
char helpString[256];
XtAppContext app;

Widget shell = XtVaAppInitialize( &app, "test", NULL, 0, // create shell
&argc, argv, NULL,
NULL );
Atom wm_delete_window = XmInternAtom( XtDisplay(shell), "WM_DELETE_WINDOW", False ); // activate WM button to close application
XmAddWMProtocolCallback( shell, wm_delete_window, (XtCallbackProc)closeCB, NULL );

Widget mainWindow = XtVaCreateWidget( "main", xmMainWindowWidgetClass, shell,
XmNwidth, 400,
XmNheight, 300,
NULL );

// create menu-bar
Widget menuBar = XmCreateMenuBar( mainWindow, "menuBar", NULL, 0 );

// close button in menu bar
Widget close = XtVaCreateManagedWidget( "Close", xmCascadeButtonGadgetClass, menuBar,
XmNmnemonic, 'C',
XmNaccelerator, "AltC",
XmNborderWidth, 0,
NULL );
XtAddCallback( close, XmNactivateCallback, (XtCallbackProc)closeCB, NULL );

// create work area
Widget pane = XtVaCreateWidget( "pane", xmPanedWindowWidgetClass, mainWindow,
XmNorientation, XmHORIZONTAL,
NULL );

Widget scroller = XtVaCreateWidget( "scroller", xmScrolledWindowWidgetClass, pane,
XmNscrollingPolicy, XmAPPLICATION_DEFINED,
XmNpaneMinimum, 100,
XmNpaneMaximum, 200,
// neither of these have any effect
// XmNskipAdjust, True,
// XmNallowResize, False,
NULL );

Widget text = XtVaCreateManagedWidget( "cycleText", xmTextWidgetClass, scroller,
XmNeditable, False,
XmNeditMode, XmMULTI_LINE_EDIT,
XmNcursorPositionVisible, False,
XmNwordWrap, False,
XmNhighlightThickness, 0,
NULL );

Widget scroller2 = XtVaCreateWidget( "scroller2", xmScrolledWindowWidgetClass, pane,
XmNscrollingPolicy, XmAPPLICATION_DEFINED,
XmNpaneMinimum, 100,
NULL );

Widget text2 = XtVaCreateManagedWidget( "cycleText", xmTextWidgetClass, scroller2,
XmNrows, 5,
XmNeditable, False,
XmNeditMode, XmMULTI_LINE_EDIT,
XmNcursorPositionVisible, False,
XmNwordWrap, False,
XmNhighlightThickness, 0,
NULL );

for ( int i = 0; i < 10; i += 1 ) {
sprintf( helpString, "Cycle %d:\n", i);
XmTextInsert( text, XmTextGetLastPosition( text ), helpString );
XmTextInsert( text2, XmTextGetLastPosition( text2 ), helpString );
} // for

XmTextSetCursorPosition( text, 0 ); // position to start
XmTextSetCursorPosition( text2, 0 ); // position to start

XmMainWindowSetAreas( mainWindow, menuBar, (Widget)NULL, (Widget)NULL, (Widget)NULL, pane );
XtManageChild( scroller );
XtManageChild( scroller2 );
XtManageChild( pane );
XtManageChild( menuBar );
XtManageChild( mainWindow );
XtRealizeWidget( shell ); // realize shell

XtAppMainLoop( app );
}


// Local variables: //
// compile-command: "g++ test5.cc -L/opt/SUNWmotif/lib -lXm -lX11 -lXt" //
// End: //