The Main Window widget provides a standard layout for the primary window of an application.
The Main Window is an example of a Scrolled Window and shares the same resource panel.
The Main Window widget contains two scrollbars and three separator widgets. You may add up to four child widgets of your own, although the Main Window does make some assumptions about the purpose of added children. You may optionally add a menu bar, a work area, a message window and a command window by selecting from the Widget Palette. If no work area child is added to the Main Window, Motif will generate warning messages at run-time. The command window is determined by entering the widget name in the Command Window field of the Main Window resource panel.
Any menu bar is placed by the Main Window to span the top of the window horizontally.
The first child added (which is not a MenuBar or a Command widget) is assumed to be the Work Area. A subsequent child will be assumed to be the Message Window. You may override these assumptions using the Message Window resource in the resource panel.
A Main Window is usually used to provide a menu bar and a work region. The work region can be almost any widget but is usually a container widget such as a Form or RowColumn. You may not directly add more than one menubar to the Main Window.
For more information on the Main Window, consult XmMainWindow(3X) in the OSF/Motif Programmer's Reference.
HINTS
The Main Window widget does not resize to accommodate children, although it does resize while children are being added to it in WorkShop Visual. For example, if you create a Main Window containing a menu bar with several cascade buttons, the Main Window will appear to be the correct size. If you later read in the same design, or run generated code, the Main Window may be too small. The solution is to use explicit sizing for Main Windows.
The Main Window widget gives a scrolled window onto the work area. If you want a window which will resize to accommodate the work area (for instance, where the work area is a form and the default should be to have all the form visible) Main Window is not appropriate. Instead, you should use a form with a menu bar child stretched across the top.
See also: