Standard windows are used to display the contents of data objects. The contents of a data object may, in turn, be comprised of other objects. For example, if the data object is a directory on a workstation's fixed disk, its contents are files, which are themselves objects. Alternatively, a data object may contain information in the form of text or formatted data. Note that an object may be defined by the user during execution; for example, if the user is editing a text file and selects a block of text to be operated upon, then that block of text becomes the scope of the following series of actions, and is thus defined as an object.
By convention, the nature of a user's interaction with a standard window should be unformatted and modeless; a standard window is used to display objects or their contents, from which the user selects an object upon which to perform one or more actions. The exact sequence of actions performed by the user in the window should not be of concern to the application. If a modal or otherwise structured dialog with the user is required, the application developer should implement this dialog as a dialog box. For this reason, it is recommended that the use of control windows be confined wherever possible to dialog boxes only. An allowable exception to this rule is the instance where a standard window displays a list of objects; in this case, the client window may be created as a container window or listbox.
This is relatively simple for normal listboxes; however, for a listbox with special display requirements and which is therefore created with the style LS_OWNERDRAW, the application must subclass the frame window in order to intercept and process the WM_DRAWITEM messages which are sent to the listbox's owner (the frame) whenever a listbox item must be redrawn on the screen.
A standard window should normally be both sizable and movable on the screen, allowing the user to configure the visual appearance of the desktop to suit the tasks being performed. A standard window should therefore be created with the FCF_SIZEBORDER style attribute in order to generate a sizing border for the window. Similarly, the user should be able to maximize and minimize the window in order to more clearly display information, unless the logical requirements of the application scenario dictate otherwise; the standard window should thus also be created with the FCF_MINMAX style attribute. A window that is neither sizable nor able to be minimized or maximized is by definition an optimized window, and should be implemented using a dialog box.
A standard window should always possess a title bar, to indicate the nature of the window's contents, and to provide a "handle" for moving the window on the screen; the frame window should therefore be created with the FCF_TITLEBAR style attribute. For an application's main window, the text displayed in the title bar should be the same as that displayed in the OS/2 Window List entry for the application, and should follow the convention "Object Name - View".
For child windows containing objects or their contents, the window title should be the same as the name or identifier of the item in the parent window that caused the child window to be created. For instance, the selection of a "Customer List" entry in the main window of an "Address Book" application might cause the display of a child window containing a list of customers' names; the title of this window would be "Customer List - Details View". Since a standard window represents an object or group of objects, the title should always be a noun rather than a verb.
A standard window is created using the WinCreateWindow() or WinCreateStdWindow() functions. WinCreateWindow() creates the frame and client windows in separate steps, whereas WinCreateStdWindow() creates both in a single step. A standard window is typically created with the FCF_SIZEBORDER, FCF_SYSMENU, FCF_TITLEBAR, FCF_MINMAX and FCF_MENU style attributes specified for the frame window. See Figure "Sample Application Main Routine (Part 2) - Window Creation" for an illustration of the use of these style attributes.
If an icon and/or accelerator table will be associated with the window, the FCF_ICON and FCF_ACCELTABLE style attributes should be specified. The icon and accelerator table definitions will then be loaded from the specified resource file when the window is created.
If the application does not wish to explicitly size and position a frame window on the desktop, the FCF_SHELLPOSITION style attribute may be specified. Presentation Manager will then determine a default size and position for the window.
As an alternative to specifying all of the above attributes, the FCF_STANDARD attribute may be specified. This attribute is assumed if the WinCreateStdWindow() call or the WinCreateWindow() call for a frame window contains no control data.