PMGuide - Frame Windows
Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation
Frame Windows
A frame window is the basic window used by most Presentation Manager applications to enable the user to perform manipulation functions. This chapter explains how to create and use frame windows in PM applications.
About Frame Windows
An application nearly always starts with a frame window to create a composite window (for example, a main window) that consists of the frame window, several frame-control windows, and a client window. The frame controls conform to the Common User Access (CUA) user interface guidelines. The frame window coordinates the actions of the frame controls and client window, enabling the composite window to act as a single unit. Frame windows have the preregistered public window class WC_FRAME. The frame-window class, like the preregistered control classes, defines the appearance and behavior of the frame window.
Main Window
The main window of an application, typically, is composed of a frame window and a client window. The frame window usually includes control windows such as a title bar, system menu, menu bar (action bar or menu in user terminology), and scroll bars. A frame window provides the standard services the user expects from a window—for example, moving, sizing, minimizing, and maximizing. The frame window receives input from the control windows (called frame controls) and sends messages to both the frame controls and the client window.
Frame Controls
When creating a frame window, an application also can create one or more frame controls as child windows of the frame window. Most frame windows contain at least a system menu and title bar. Other optional controls might include a menu bar and scroll bar as shown above. An application can create a frame window with specified frame controls by calling WinCreateStdWindow with the appropriate frame-control flags. The frame window owns the child frame-control windows, which can send notification messages that tell the frame window what the user is doing with the frame controls. For example, using a mouse, a user can move a window by clicking the title bar and dragging the window to a new position. The title-bar control responds to the click by sending a message to the frame window, notifying it of the user's request to move the window. Then the frame window tracks the mouse motion and moves the frame window and all of its child windows to the new position. PM, rather than the application, handles the processing of the frame controls, thus providing the user a consistent interface for manipulating and interacting with windowed applications on the screen. Frame controls are described in individual chapters. For more information about control windows, see Control Windows.
Client Window
Every main window has a client window, which is the window in which the application displays output and receives mouse and keyboard input from the user. What an application displays in the client window, how it displays it, and how it interprets input to the window are controlled by the client's application-defined window procedure. An application creates the client window when it creates the frame window. The client window, which is specific to the application, is nearly always created using a private window class (a class registered by the application). Like a frame control, the client window is a child window and is owned by the frame window. This means, for example, that the client window is moved when the frame window moves, is clipped to the frame-window size, and is destroyed when the frame window is destroyed. The relationship between the frame window and the client window allows the frame window to pass messages between other frame controls and the client window. For example, a client window can send a message to the frame window requesting that the frame window change the window title. The frame window, in turn, sends a message to the title-bar control, telling it to change the title of the window.
Additional Frame-Window Items
In addition to its frame controls, a frame window also can contain a sizing border and the minimize and maximize buttons (also known as minimize and maximize icons). These items are not frame controls, because the frame window draws and maintains them. (Frame controls are windows that draw and maintain themselves.) The sizing border encloses the frame window and lets the user change the size of the window using a mouse. The minimize button, at the right end of the title bar, lets the user reduce the frame window to an icon. The maximize button, to the right of the minimize button, lets the user enlarge the window so that it fills the screen. An application can add these items to a frame window by using the FCF_SIZEBORDER, FCF_MAXBUTTON, and FCF_MINBUTTON (or FCF_MINMAX) styles. (The FCF_MINMAX style adds both a maximize button and a minimize button.)
Frame-Control Identifiers
A frame window uses a set of standard constants to identify the frame controls and the client window. The frame-control identifiers all begin with the prefix FID_ and can be used in functions such as WinWindowFromID to uniquely identify a given control or the client window. The frame controls also use these identifiers in notification messages sent to the frame window. The following table describes the frame-control identifiers:
Identifier | Description |
---|---|
FID_CLIENT | Identifies a client window. |
FID_HORZSCROLL | Identifies a horizontal scroll bar. |
FID_MENU | Identifies a menu. |
FID_MINMAX | Identifies the minimize and maximize (window-sizing) buttons. |
FID_SYSMENU | Identifies a system menu. |
FID_TITLEBAR | Identifies a title bar. |
FID_VERTSCROLL | Identifies a vertical scroll bar. |