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 / Closing and Deallocating Windows


TrackGoAway

Use the TrackGoAway function to track the cursor when the user presses the mouse button while the cursor is in the close box.

FUNCTION TrackGoAway (theWindow: WindowPtr;
                        thePt: Point): Boolean;
theWindow
A pointer to the window record of the window in which the mouse-down event occurred.
thePt
The location of the cursor at the time the mouse button was pressed. Your application receives this point from the where field of the event record.
DESCRIPTION
The TrackGoAway function tracks cursor activity when the user presses the mouse button while the cursor is in the close box, retaining control until the user releases the mouse button. While the button is down, TrackGoAway highlights the close box as long as the cursor is in the close region, as illustrated in Figure 4-19 on page 4-46.

When the mouse button is released, TrackGoAway removes the highlighting from the close box and returns TRUE if the cursor is within the close region and FALSE if it is not.

Your application calls the TrackGoAway function when it receives a result code of inGoAway from the FindWindow function. If TrackGoAway returns TRUE, your application calls its own procedure for closing a window, which can call either the CloseWindow procedure or the DisposeWindow procedure to remove the window from the screen. (Before removing a document window, your application ordinarily checks whether the document has changed since the associated file was last saved.
See the chapter "Introduction to File Management" in Inside Macintosh: Files for a
general discusion of handling files.) If TrackGoAway returns FALSE, your application does nothing.

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 TrackGoAway 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-9 on page 4-44 for an example that calls TrackGoAway to track cursor activity when the user presses the mouse button while the cursor is in the close box.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996