Reference Guide > W Routines > WwMainWindow Function
  

WwMainWindow Function
Creates a top-level window and a layout widget.
Usage
shell = WwMainWindow(parent, workarea, [destroyCallback])
Input Parameters
parent — The widget ID of the parent widget.
destroyCallback — A string containing the name of the callback that is executed when the main window is destroyed.
Output Parameters
workarea — The widget ID of the layout widget that is created inside of the top-level shell.
Returned Value
shell — The widget ID of the top-level shell.
Keywords
Board — If present and nonzero, a bulletin board layout is created inside the main window shell. See WwLayout Function for more information.
Border — Specifies the width in pixels of the borders for the layout widget and its child widgets. Default is 0.
ConfirmClose — A string containing the name of the procedure called when the user selects the Close or Quit menu button from the window manager menu.
Form — If present and nonzero, a form layout is created inside the shell. See the WwLayout Function for more information.
Height — An integer specifying the height (in pixels) of the top level widget.
Horizontal — If present and nonzero, aligns child widgets horizontally within the layout widget (the default). Used with row/column layouts only. For more information on layout widgets, see the WwLayout Function.
Icon_file — A string containing either the full pathname or the filename of the icon file. If the icon file is not found, then the warning message, "Unable to find specified icon file: filename, using default icon file." appears.
 
note
The default icon definition is based on Windows vs. Motif as the window manager. On Windows, the default becomes the parent icon definition or the system icon if no parent has defined a unique window icon. On Motif, the default becomes the icon defined by !WIDGET_ICON.
Layout_name — Specifies the name of the layout widget which is part of the resource specification. The default depends on other keywords specified in the WwMainWindow usage.
*If either Board or Form are specified, the Layout_name default is layout.
*If either Horizontal or Vertical are specified, the default for Layout_name is workarea.
Position — Specifies the x, y position of the upper-left corner of the main window on the screen.
Shell_name — Specifies the name of the top-level layout widget, or TopLevelShell which is part of the resource specification. (Default: shell.)
Spacing — Specifies the amount of space in pixels between child widgets inside the layout. Used with row/column layouts only. Default is 0. For more information on layout widgets, see the WwLayout Function.
Title — A string specifying a title for the shell.
UserData — A variable. If the ConfirmClose keyword is specified, the value of this variable is passed to the Close or Quit callback procedure.
Vertical — If present and nonzero, aligns child widgets vertically within the layout widget. Used with row/column layouts only. For more information on layout widgets, see the WwLayout Function.
Width — An integer specifying the width (in pixels) of the top level widget.
Color/Font Keywords
Background — Specifies the background color name.
Font — Specifies the name of the font used for text.
MSFont — Adds support for Windows fonts.
Foreground — Specifies the foreground color name.
Get/Set Value
Not supported.
Callback Parameters
Any main window callback procedure must have the following two parameters:
shell — Main window shell widget ID.
layout — Layout widget ID.
Discussion
The WwInit function creates one main window, and for many applications, this is sufficient. WwMainWindow gives you the ability to create additional main windows and layout widgets.
By default, the WwMainWindow creates a row/column layout widget. For more information on layout widgets, see the WwLayout Function.
The ConfirmClose keyword lets you control what happens when the user selects Close or Quit from the window manager menu. Normally, the window from which the menu item was selected is destroyed; however, you might want to display a confirmation dialog box or take another action instead of simply allowing the window to be destroyed. The callback procedure specified by ConfirmClose destroys the window when appropriate.
The ConfirmClose procedure you specify accepts two parameters: wid and user_data, where:
*wid — The widget ID of the top-level shell of the application.
*user_data — The variable specified via the User_Data keyword. If User_Data is not specified, 0 (zero) is passed to the ConfirmClose routine.
If specified, your ConfirmClose routine must close the top-level shell of the application. An example of a simple ConfirmClose routine which just closes the shell is:
PRO MyConfirmClose, wid, user_data
s = WwSetValue(wid, /Close)
END
If ConfirmClose is not specified, then the shell is simply closed.
Example
This example shows a call to the WwMainWindow function. No callback is specified.
shell = WwMainWindow(parent,form, destroyCB, $
   /Vertical, Title = 'Topics')
See Also
For detailed information on GUI development, refer to the PV‑WAVE Application Developer’s Guide.
For more information about how to write an application program based on PV‑WAVE Widgets, refer to Using Wave Widgets in the PV‑WAVE Application Developer’s Guide.
For additional information on the color and font keywords, see "Setting Colors and Fonts" in the PV‑WAVE Application Developer’s Guide.

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.