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 / Window Manager Reference
Window Manager Routines / Resizing Windows


GrowWindow

Use the GrowWindow function to allow the user to change the size of a window. The GrowWindow function displays an outline (grow image) of the window as the user moves the cursor to make the window larger or smaller; it handles all user interaction until the user releases the mouse button. After calling GrowWindow, you call the SizeWindow procedure to change the size of the window.

FUNCTION GrowWindow (theWindow: WindowPtr; 
                     startPt: Point; sizeRect: Rect): LongInt;
theWindow
A pointer to the window record of the window to drag.
startPt
The location of the cursor at the time the mouse button was first pressed, in global coordinates. Your application retrieves this point from the where field of the event record.
sizeRect
The limits on the vertical and horizontal measurements of the port rectangle, in pixels.
Although the sizeRect parameter is in the form of the Rect data
type, the four numbers in the structure represent lengths, not
screen coordinates. The top, left, bottom, and right fields of the sizeRect parameter specify the minimum vertical measurement
(top), the minimum horizontal measurement (left), the maximum vertical measurement (bottom), and the maximum horizontal measurement (right).
The minimum measurements must be large enough to allow a manageable rectangle; 64 pixels on a side is typical. Because the user cannot ordinarily move the cursor off the screen, you can safely set
the upper bounds to the largest possible length (65,535 pixels) when you're using GrowWindow to follow cursor movements.
DESCRIPTION
The GrowWindow function moves a dotted-line image of the window's right and lower edges around the screen, following the movements of the cursor until the mouse button is released. It returns the new dimensions, in pixels, of the resulting window: the height in the high-order word of the returned long-integer value and the width in the low-order word. You can use the functions HiWord and LoWord to retrieve only the high-order and low-order words, respectively.

A return value of 0 means that the new size is the same as the size of the current
port rectangle.

ASSEMBLY-LANGUAGE INFORMATION
You can set the global variable DragHook to point to an optional procedure, defined by your application, which will be called by GrowWindow as long as the mouse button is held down. (If there's an actionProc procedure, the actionProc procedure is called first.) Note that the use of the Window Manager's global variables is not guaranteed to be compatible with system software versions later than System 6.

SEE ALSO
See Listing 4-13 on page 4-58 for an example that calls GrowWindow when the user presses the mouse button while the cursor is in the size box.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996