Important: The information in this document is obsolete and should not be used for new development.
GrowWindow
Use theGrowWindowfunction to allow the user to change the size of a window. TheGrowWindowfunction 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 callingGrowWindow, you call theSizeWindowprocedure 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
wherefield of the event record.- sizeRect
- The limits on the vertical and horizontal measurements of the port rectangle, in pixels.
- Although the
sizeRectparameter is in the form of theRectdata
type, the four numbers in the structure represent lengths, not
screen coordinates. Thetop,left,bottom, andrightfields of thesizeRectparameter 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 usingGrowWindowto follow cursor movements.DESCRIPTION
TheGrowWindowfunction 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 functionsHiWordandLoWordto 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 variableDragHook to point to an optional procedure, defined by your application, which will be called by GrowWindowas long as the mouse button is held down. (If there's anactionProcprocedure, theactionProcprocedure 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 callsGrowWindowwhen the user presses the mouse button while the cursor is in the size box.