Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Macintosh Toolbox Essentials /
Chapter 4 - Window Manager


Using the Window Manager

Virtually every Macintosh application uses the Window Manager, both to simplify
the display and management of windows and to retrieve basic information about
user activities.

Your application works in conjunction with the Window Manager to present the standard user interface for windows. When the user clicks in an inactive window belonging to your application, for example, you can call the procedure SelectWindow, which highlights the newly active window, removes the highlighting from the previously active window, and generates the activate events that trigger the activation and deactivation of the two affected windows.

Your application can also use Window Manager routines to handle direct window manipulation. For example, if the user presses the mouse button when the cursor is in the title bar of a window, you can call the DragWindow procedure to track the mouse and drag an outline of the window on the screen until the user releases the mouse button.

You typically create windows from window resources, which are resources of type 'WIND'. The Window Manager supports the nine types of windows described in "Types of Windows" beginning on page 4-7. (You can also write your own window definition functions to support your own window types. Window definition functions are stored as resources of type 'WDEF'.) Alert box windows and dialog box windows use alert ('ALRT'), dialog ('DLOG'), and item list ('DITL') resources; the chapter "Dialog Manager" describes how to create these resources. Most windows contain controls, which are defined through control ('CNTL') resources; the chapter "Control Manager" describes how to create control resources.

Your application typically uses the Window Manager in conjunction with both the Control Manager and the Dialog Manager. You use the Control Manager to define, draw, and manipulate controls in your windows. If your window includes scroll bars, for example, you can use the TrackControl function to track the mouse while the user drags the scroll box. You can use the Dialog Manager to create, display, and track events in alert boxes and dialog boxes.

System 7 provides help balloons for the window frame--that is, the title bar, zoom box, and close box--of a window created with one of the standard window definition functions. You should provide help balloons for your window content region--that is, the size box, controls, and data area--and for the window frames of any window types you define. See the chapter "Help Manager" in Inside Macintosh: More Macintosh Toolbox for a description of how to use help balloons.

Before using the Window Manager, you must call the procedure InitGraf to initialize QuickDraw, the procedure InitFonts to initialize the Font Manager, and finally the procedure InitWindows to initialize the Window Manager.


Subtopics
Managing Multiple Windows
Creating a Window
Drawing the Window Contents
Updating the Content Region
Maintaining the Update Region
Handling Events in Windows
Moving a Window
Zooming a Window
Resizing a Window
Closing a Window
Hiding and Showing a Window

Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996