[comp.windows.x.motif] How to create separate windows ??

jaysun@citron..cs.clemson.edu (Jay Williamson - System Manager) (04/22/91)

I am new to Motif programming so bear with me.  We are running
Motif 1.1.1 and X11 R4 patch level 18.

I want to create an application that has a control panel and another
completely separate window also.

This should be very simple yet a can't make it work.  I have looked
at the demos and I follow their lead but with no luck.

I have tried many different ways an my present stage is below.

Here is a code fragment with many extras taken out:

		XtToolkitInitialize();
    app_context = XtCreateApplicationContext();
    display = XtOpenDisplay(app_context, NULL, argv[0], "MNSFEdit",
                            NULL, 0, &argc, argv);
    toplevel = XtAppCreateShell (argv[0], NULL, applicationShellWidgetClass,
                              display, arglist, n);

		mainW = XmCreateMainWindow (toplevel, "mainW", arglist, n);
    XtManageChild (mainW);

		pageW = XmCreateBulletinBoard (toplevel, "PageW", arglist, n);
    XtManageChild (pageW);

		controlW = XmCreateDialogShell (toplevel, "PageDisplayControlPanel",
			arglist, n);
		XtManageChild(controlW);

    XtRealizeWidget(toplevel);

    XtAppMainLoop(app_context);
-------------------------------------

Something like this would be nice with mainW and controlW being
different windows entirely.

                       toplevel
                      /       \
                  mainW      controlW
                  /
              pageW

I understand most of the Widget/child stuff but I am a little fuzzy
on how the top level widget ties things together.

Reply straight to me if possible.

Thanks,

Jay Williamson, Systems Manager              Clemson University
jaysun@cs.clemson.edu                        Computer Science Dept.
(803) 656-2639                               Clemson, S.C.  29634-1906

wwang@osf.org ("Weidong Wang from OSF") (04/22/91)

  >  
  >  I want to create an application that has a control panel and another
  >  completely separate window also.
  >  
What you should do is to create two shells, not just two widgets under one
shell.

  >  
  >  Here is a code fragment with many extras taken out:
  >  
  >  		XtToolkitInitialize();
  >      app_context = XtCreateApplicationContext();
  >      display = XtOpenDisplay(app_context, NULL, argv[0], "MNSFEdit",
  >                              NULL, 0, &argc, argv);
  >      toplevel = XtAppCreateShell (argv[0], NULL, applicationShellWidgetClass,
  >                                display, arglist, n);
  >  
	 XtManageChild(XmCreateFileSelectionBox(toplevel, "fb", args, 0));

	 shell2 = XtCreateWidget("shell2", topLevelShellWidgetClass, toplevel,
				 args, 0);

  >  		mainW = XmCreateMainWindow (shell2, "mainW", arglist, n);
  >      XtManageChild (mainW);
  >  
  >  		controlW = XmCreateBulletinBoardDialog (toplevel,
"PageDisplayControlPanel",
  >  			arglist, n);
  >  
  >      XtRealizeWidget(toplevel);
  > 
	 XtRealizeWidget(shell2);
	 XtManageChild(controlW);

  >      XtAppMainLoop(app_context);
  >  -------------------------------------
  >  

This will give you a shell with a file selectionbox in it, another shell with a
main window init, and a dialog bulletin board shell. 3 windows.

Hope this helps.


Weidong Wang
Systems, Engineering, OSF