[comp.windows.x] MOTIF MainWindow Problem. HELP!

gerolima@wdl1.wdl.fac.com (Mark K Gerolimatos) (07/28/90)

The following program does not seem to work for me, and I don't know why. 
Currently, I am using vanilla Motif-1.0.a on a Sun/3 running 4.0.3 and R4 (yeah,
I know...doesn't work with R3, either). I have also tried linking it with
TELEUSE libraries, but the same problem still comes up.

Please tell me, oh tell me do:
1) Is this program "wrong", or should it work?
2) Try it out, and tell me how it worked (please include your MOTIF/OS
	configuration). Of course, if you have the same {hard,soft}ware,
	and get the same problem, you don't have to bother writing.

	Mark Gerolimatos (gerolima@wdl34.wdl.fac.com)

				---cut here---

#if 0
This here piece-o-code simply makes a main window with a command window
containing a single button named "Booji Boy", and a text edit widget with
(when necessary) a scrollbar.

When the scrollbar is removed (by commenting out the line below...see the 
comments), this program looks fine. But, WITH the scrollbar, all hell breaks
loose...the command window gets moved down a bit, colliding with the text edit
window, and a cute mini scrollbar appears on the left side of where the
stupid command window SHOULD BE.
#endif 0

#include <Xm/Xm.h>
#include <Xm/MainW.h>
#include <Xm/Text.h>
#include <Xm/ScrollBar.h>
#include <Xm/Form.h>
#include <Xm/PushB.h>

Widget toplevel,  mainw,  textw, scrollbar, command_window,
					button;

main (argc,argv)
int argc;
char **argv;
{

	Arg list[10]; int n;

	toplevel = XtInitialize("Burger Time", "Butter Ball",
						NULL,0,&argc,argv);
	n = 0;
	/* when argc > 1, don't include the scrollbar */
	if(argc > 1)
		XtSetArg(list[n],XmNscrollingPolicy,XmAUTOMATIC);n++;
	mainw = XmCreateMainWindow(toplevel,"Billy Bob",list,n);
	n = 0;
	command_window = XmCreateForm(mainw,"Boffo Big",list,n);
	n = 0;
	button = XmCreatePushButton(command_window,"Booji Boy",list,n);
	n = 0;
	XtSetArg(list[n],XmNeditMode,XmMULTI_LINE_EDIT);n++;
	XtSetArg(list[n],XmNcolumns,80);n++;
	XtSetArg(list[n],XmNrows,24);n++;
	XtSetArg(list[n],XmNresizeHeight,True);n++;
	textw = XmCreateText(mainw,"Birming Ham",list,n);
	n = 0;
	scrollbar = XmCreateScrollBar(mainw,"Briga Doon",list,n);

	n = 0;
	XtSetArg(list[n],XmNworkWindow,textw);n++;
	XtSetArg(list[n],XmNcommandWindow,command_window);n++;
	XtSetValues(mainw,list,n);

	XtManageChild(mainw);
	XtManageChild(textw);
	XtManageChild(button);
	XtManageChild(command_window);
	XtManageChild(scrollbar);
	XtRealizeWidget(toplevel);

	XtMainLoop(toplevel);
}