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 5 - Control Manager / Control Manager Reference
Control Manager Routines / Drawing Controls


UpdateControls

To update controls in a window, you can use the UpdateControls procedure. The UpdateControls procedure is also available as the UpdtControl procedure.

PROCEDURE UpdateControls (theWindow: WindowPtr; 
                          updateRgn: RgnHandle);
theWindow
A pointer to the window containing the controls to update.
updateRgn
The update region within the specified window.
DESCRIPTION
The UpdateControls procedure draws those controls that are in the specified update region. This procedure is faster than the DrawControls procedure, which draws all of the controls in a window. By contrast, UpdateControls draws only those controls in the update region.

Your application should call UpdateControls upon receiving an update event for a window that contains controls. Window Manager routines such as SelectWindow, ShowWindow, and BringToFront do not automatically call DrawControls to display the window's controls. They just add the appropriate regions to the window's update region, generating an update event.

In response to an update event, you normally call UpdateControls after using the Window Manager procedure BeginUpdate and before using the Window Manager procedure EndUpdate. You should set the updateRgn parameter to the visible region of the window's port, as specified in the port's visRgn field.

SPECIAL CONSIDERATIONS
If your application draws parts of a control outside of its rectangle, UpdateControls might not redraw it.

The Dialog Manager handles update events for controls in alert boxes and dialog boxes.

SEE ALSO
Listing 5-8 on page 5-27 illustrates the use of UpdateControls. The BeginUpdate and EndUpdate procedures are described in the chapter "Window Manager" in this book. See the chapter "Dialog Manager" in this book for more information about including controls in alert boxes and dialog boxes.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996