Futurebasic/Language/Reference/get window

GET WINDOW edit

Syntax edit

GET WINDOW [#]wndID, windowPtrVar&

Description edit

This statement returns a pointer to the window record for the window specified by wndID<]. The pointer is returned into windowPtrVar& , which must be a long-integer variable or a POINTER variable. A window record is a data structure which contains information about the window, such as its current visibility status, current background & foreground colors, and much, much more. In addition, you need to specify a window record pointer whenever you call any Toolbox routine that deals with windows. For information about the contents of the window record, see the "http://developer.apple.com/documentation/mac/Toolbox/Toolbox-188.html#HEADING188-0""Window Manager" chapter of "http://developer.apple.com/documentation/macos8/mac8.html"Inside Macintosh: "http://developer.apple.com/documentation/mac/Toolbox/Toolbox-2.html"Macintosh Toolbox Essentials, as well as the descriptions of grafPort and CGrafPort data structures in "http://developer.apple.com/documentation/macos8/mac8.html" "blank"Inside Macintosh: "http://developer.apple.com/documentation/mac/QuickDraw/QuickDraw-2.html" "blank"Imaging with QuickDraw.

FB uses the window record's RefCon field to maintain information about the window, including its class, its modality (modal or not), its ID number, and its type. This information is only valid for windows created using the WINDOW statement. You can access this information as follows:

refCon& = windowPtr&.wRefCon&
class = (refCon& <b>AND</b> &FF)
isModal = ((refCon& <b>AND</b> &FF00) <> 0)
windowID = (refCon& <b>AND</b> &FF0000) >> 16
windowType = ((refCon& <b>AND</b> &FF000000) >> 24) + 1

Note: Your program should not dispose of the window record (i.e., don't pass the pointer to FN DISPOSPTR). The system automatically disposes of it when you close the window.

See Also edit

WINDOW statement; WINDOW function; USR; WPTR2WNUM