Important: The information in this document is obsolete and should not be used for new development.
TrackGoAway
Use theTrackGoAway
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
TheTrackGoAway
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 returnsTRUE
if the cursor is within the close region andFALSE
if it is not.Your application calls the
TrackGoAway
function when it receives a result code ofinGoAway
from theFindWindow
function. IfTrackGoAway
returnsTRUE
, your application calls its own procedure for closing a window, which can call either theCloseWindow
procedure or theDisposeWindow
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.) IfTrackGoAway
returnsFALSE
, your application does nothing.ASSEMBLY-LANGUAGE INFORMATION
You can set the global variableDragHook
to point to an optional procedure, defined by your application, which will be called byTrackGoAway
as long as the mouse button is held down. (If there's anactionProc
procedure, theactionProc
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 callsTrackGoAway
to track cursor activity when the user presses the mouse button while the cursor is in the close box.