Important: The information in this document is obsolete and should not be used for new development.
TrackGoAway
Use theTrackGoAwayfunction 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
wherefield of the event record.DESCRIPTION
TheTrackGoAwayfunction 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,TrackGoAwayhighlights 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,
TrackGoAwayremoves the highlighting from the close box and returnsTRUEif the cursor is within the close region andFALSEif it is not.Your application calls the
TrackGoAwayfunction when it receives a result code ofinGoAwayfrom theFindWindowfunction. IfTrackGoAwayreturnsTRUE, your application calls its own procedure for closing a window, which can call either theCloseWindowprocedure or theDisposeWindowprocedure 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.) IfTrackGoAwayreturnsFALSE, your application does nothing.ASSEMBLY-LANGUAGE INFORMATION
You can set the global variableDragHookto point to an optional procedure, defined by your application, which will be called byTrackGoAwayas 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-9 on page 4-44 for an example that callsTrackGoAwayto track cursor activity when the user presses the mouse button while the cursor is in the close box.