# Futurebasic/Language/Reference/window function
## WINDOW
### Syntax

Revision: February, 2002 (Release 6)

### Description

This function returns information related to a window (usually the current output window). The value you specify in expr determines what kind of information is returned, as described in the following paragraphs.
ID's of Active Window , Active Document Window, Active Palette Window and Output Window
* WINDOW(_activeWnd) returns the window ID number of the currently active window, or zero if no window is active.
* WINDOW(_activeDoc) returns the window ID number of the currently active document window or zero if no document window is active. In searching for the active document, this function bypasses all palettes in search of a window with the type attribute set to include _keepInBack.
* WINDOW(_activePlt) returns the window ID number of the frontmost palette. In order for there to be a palette, one or more document windows must be open with the type attribute set to include _keepInBack. At that point, all non-_keepInBack windows become palettes and float over the document windows.
* WINDOW(_outputWnd) returns the window ID number of the current output window, or zero if output is currently directed to somewhere besides a FutureBasic-created screen window (e.g., to the printer).
Window Size
* WINDOW(_width) returns the width (in pixels) of the content region of the current output window.
* WINDOW(_height) returns the height (in pixels) of the content region of the current output window. (Note: The content region does not include the window's frame.)
Window Position (Appearance manager)
* WINDOW(_kFBstructureTop) returns the distance from the top of the screen to the top of the structure region of the window.
* WINDOW(_kFBstructureLeft) returns the distance from the left of the screen to the left of the structure region of the window.
* WINDOW(_kFBstructureWidth) returns the width of the window's structure region.
* WINDOW(_kFBstructureHeight) returns the height of the window's structure region.
* WINDOW(_kFBcontentTop) returns the distance from the top of the screen to the top of the content region of the window.
* WINDOW(_kFBcontentLeft) returns the distance from the left of the screen to the left of the content region of the window.
* WINDOW(_kFBcontentWidth) returns the width of the window's content region. This is normally the same as WINDOW(_width).
* WINDOW(_kFBcontentHeight) returns the height of the window's content region. This is normally the same as WINDOW(_height).
Pen Position
* WINDOW(_penH) returns the horizontal position (in pixels) of the pen in the current output window.
* WINDOW(_penV) returns the vertical position (in pixels) of the pen in the current output window.
Window Record Pointer
* WINDOW(_wndPointer OR _wndRef) returns a pointer to the Window Record of the current output window. For information about the contents of the Window Record, see the <a href="get%20window.html">GET WINDOW</a> statement, and the <a href="http://developer.apple.com/documentation/mac/Toolbox/Toolbox-188.html#HEADING188-0">"Window Manager" chapter</a> of <a href="http://developer.apple.com/documentation/macos8/mac8.html">Inside Macintosh</a>: <a href="http://developer.apple.com/documentation/mac/Toolbox/Toolbox-2.html">Macintosh Toolbox Essentials</a>, as well as the descriptions of grafPort and CGrafPort data structures in <a href="http://developer.apple.com/documentation/macos8/mac8.html">Inside Macintosh</a>: <a href="http://developer.apple.com/documentation/mac/QuickDraw/QuickDraw-2.html">Imaging with QuickDraw</a>.
* WINDOW(_wndPort) return the current grafport being used for output.
Clipboard Contents
* WINDOW(_textClip) returns a nonzero value if there is information of type "TEXT" on the clipboard; returns zero otherwise.
* WINDOW(_pictClip) returns a nonzero value if there is information of type "PICT" on the clipboard; returns zero otherwise.
Window Class (Standard BASIC only)
* WINDOW(_outputWClass) returns the "class number" assigned to the current output window.
* WINDOW(_activeWClass) returns the "class number" assigned to the currently active window.
* WINDOW(_outputWCategory) returns the "class number" assigned to the current output window for the Appearance Manager runtime.
* WINDOW(_activeWCategory) returns the "class number" assigned to the currently active window for the Appearance Manager runtime. (See the <a href="window%20statement.html">WINDOW</a> statement for more information about class numbers).
Other Window Info (Appearance Manager)
* WINDOW(_kFBMacWClass) returns the toolbox window class. Return values might include things like _kDocumentWindowClass or _kMovableModalWindowClass
* WINDOW(_kFBMacWAttributes) returns toolbox attributes about a window. Values might include _kWindowResizableAttribute or _kWindowCloseBoxAttribute
* WINDOW(_kFBwDescHandle) returns the handle to a FBwindowDescription record which is stored in the window's refcon. While this information is subject to change, it currently contains the following data:
BEGIN RECORD FBwindowDescription  DIM FBwRef<spacer type="horizontal" size="227">AS LONG<spacer type="horizontal" size="22">// standard FB Ref number  DIM FBwZoomRect<spacer type="horizontal" size="51">AS RECT<spacer type="horizontal" size="21">// best zoom out pos, <spacer type="horizontal" size="248">// empty for default  DIM FBwAttributes<spacer type="horizontal" size="37">AS WindowAttributes  DIM FBwWindowClass AS WindowClass  DIM FBwControlList AS HANDLE // linked list of controls  DIM FBwEFList<spacer type="horizontal" size="65">AS HANDLE // linked list of EFs  DIM FBwFSSpec<spacer type="horizontal" size="65">AS FSSpec // associated file spec <spacer type="horizontal" size="248">// (affects proxy icon)  DIM FBwCreator<spacer type="horizontal" size="58">AS OSType // for proxy icon  DIM FBwFileType<spacer type="horizontal" size="51">AS OSType // for proxy icon  DIM FBidealSizeX<spacer type="horizontal" size="44">AS SHORT<spacer type="horizontal" size="15">// zoom  DIM FBidealSizeY<spacer type="horizontal" size="44">AS SHORT<spacer type="horizontal" size="15">// zoom  DIM FBwClipRgn<spacer type="horizontal" size="58">AS RgnHandle  DIM FBwVScrollH<spacer type="horizontal" size="51">AS HANDLE // 0 if no v scroll bar  DIM FBwHScrollH<spacer type="horizontal" size="51">AS HANDLE // 0 if no h scroll bar  DIM FBwCategory<spacer type="horizontal" size="51">AS LONG  DIM FBwClickThru<spacer type="horizontal" size="44">AS BOOLEAN  DIM FBwUpdateVisRgn<spacer type="horizontal" size="22">AS BOOLEAN  DIM FBwKeepInactive<spacer type="horizontal" size="22">AS BOOLEAN // for backdrop window  DIM FBwNoAutoFocus AS BOOLEAN // affects tab key <spacer type="horizontal" size="255">// handling with EFs & <spacer type="horizontal" size="255">// text buttons  DIM & END RECORD
* WINDOW(_kFBwClickThru) returns a non-zero value if this attribute bit is set.
* WINDOW(_kFBFloatingWndPtr) returns the window pointer of the frontmost floating window.
Screen Borders in Local Coordinates
* WINDOW(_toLeft) returns the horizontal pixel position of the screen's left edge, expressed in the local coordinate system of the current output window (note this will be negative if the window lies entirely on the screen).
* WINDOW(_toTop) returns the vertical pixel position of the top of the screen, expressed in the local coordinate system of the current output window (note this will be negative if the window lies entirely on the screen).
* WINDOW(_toRight) returns the horizontal pixel position of the screen's right edge, expressed in the local coordinate system of the current output window.
* WINDOW(_toBottom) returns the vertical pixel position of the bottom of the screen, expressed in the local coordinate system of the current output window.
(Note that these numbers are meaningless if output is currently directed to some place other than a screen window.)
Checking Whether a Window Exists If you specify a negative value in expr, WINDOW(expr) returns a nonzero value if there exists a window whose ID number is ABS(expr); it returns zero otherwise. The returned value does not depend on whether the window is currently visible or not; it only depends on whether the window has been created (using the WINDOW statement) and not yet closed (using the WINDOW CLOSE statement).
Edit Field and Picture Field Information
* WINDOW(_efNum) returns the ID number of the currently active edit field or picture field; or zero if there is no currently active edit field or picture field.
* WINDOW(_selStart) returns the character position of the beginning of the selected text or insertion point in the currently active edit field (if any).
* WINDOW(_selEnd) returns the character position of the end of the selected text or insertion point in the currently active edit field (if any).
* WINDOW(_efHandle) returns a handle to the TextEdit record of the currently active edit field (if any); this is the same as the value returned by TEHANDLE(WINDOW(_efNum)).
* WINDOW(_lastEfNum) returns the ID number of the previously active edit field (or zero, if no other edit field was previously active).
* WINDOW(_efTextLen) returns the number of characters in the currently active edit field (if any).
* WINDOW(_teBlock) returns a handle to the Edit Field Descriptor for the currently active edit field or picture field (if any).
* WINDOW(_efClass) returns the efClass parameter assigned to the currently active edit field (if any); or the negative of the just parameter assigned to the currently active picture field (if any).

### Note

If output is currently directed to a graphics port other than a screen window (e.g. to the printer, or to an offscreen GWorld), then references to the "current output window" apply to the current port, unless otherwise specified.

### See Also

WINDOW statement; EDIT FIELD; PICTURE FIELD; SET SELECT; TEHANDLE; GET WINDOW; SYSTEM function; APPEARANCE WINDOW; DEF WINDOWCATEGORY