||<< Index >>||
window [-] wNum[, [title][, [rect][, [windowClass][, [windowAttributes] ]]]]
windowstatement combines the features of the
Windows with and without theme backgrounds
Window'sparameters are specified as shown.
wNum- a positive or negative integer whose absolute value is in the range 1 through 2147483647.
title- a string expression. As of FB 5.7.102 this must be a Core Foundation(CF) string.
rect- a rectangle in global screen coordinates. You can express it in either of two forms:
rectparameter allows automatic centering for newly-created windows but does not for existing windows . See "Creating a New Window" for details.
Two diagonally opposite corner points.
A Core Graphics rectangle of type
CGRectrecord type ( structure ) contains x, y, width and length
windowClass- an unsigned long integer specifying the Macintosh window type to use ( i.e. the window's class ). To create a
windowClassvariable use the following syntax:
dim as WindowClass
I need your attention now.
I need your attention now, but I'm kind enough to let you switch out of this app to do other things
system modal, not draggable
application modal, draggable
floats above all other application windows. Available in OS 8.6 or later
floats above docs, below floating windows
windowAttributes- an array of signed integers describing the desired window features and behaviors such as a close box, grow box, or a collapse box. An array index, if used, holds only one window attribute. All the available window attribute constants may be found in the FB Header, Tlbx MacWindows.incl, if the following table doesn't have what is needed.
A windowAttributes array variable is dimensioned & loaded as follows.
N.B.: the array index after the last specified attribute must have zero in it:
dim as SInt32 wa(7)//Size the attribute array to contain the planned attributes. Extra indices are ignored
wa(0) = _kHIWindowBitStandardHandler <=========== Only one window attribute in each index
wa(1) = _kHIWindowBitCloseBox
wa(2) = _kHIWindowBitZoomBox
wa(3) = _kHIWindowBitCollapseBox
wa(4) = _kHIWindowBitResizable
wa(5) = _kHIWindowBitLiveResize
wa(6) = _kHIWindowBitCompositing
wa(7) = 0 <=========== Zero REQUIRED in the index following the last window attribute
collapse box (sends to MacOS X dock)
can be resized
title on side for floating window
does not receive update event
does not receive activate event
has a toolbar button in title bar
no drop shadow
resize events repeatedly sent while window is being sized
receives standard Carbon Events. FB defaults to this
the current OS default. Uses anti-aliasing.
Creating a New Window
Activate an Existing Window
wNumspecifies a unique integer value(i.e. different from the integer value assigned to any other windows in the same application ). A new window is created and assigned a positive ( takes absolute value if a negative integer is supplied )ID number from the statement's variable or constant. Once a window is created, its ID number can be used in other FutureBasic statements and functions. Creating a new window, makes it the current output window, and if created visibly, it also becomes the current active window.
titlea string specifying the window's title (if the window has a title bar). If not supplied, window titles default to "Untitled".
rectspecifies the initial size and location of the window's content rectangle. Note that
rectdoes not include the window's frame. To automatically center a newly created window, specify an x,y ( either within the
CGRectvariable or for x1, y1 in the alternate format (x1,y1)-(x2,y2 ) ) coordinate of (0,0) in
rect. Omitting this parameter results in a default size and location.
windowClassspecifies the window type.
windowAttributesspecifies the types of window widgets (close box, grow box) and behavior ( live resize ) a window will include.
Make an Existing Window Visible or Invisible
- Specify the (positive) ID number of an existing window in
wNum. You do not need to specify any of the other parameters unless you also wish to to change some of the window's characteristics. The window also becomes the current output window. If the window was invisible, it becomes visible.
windowstatement always makes the window active, unless a negative
wNumis specified. Activating a window using the
windowstatement, causes the following additional behavior:
- The window also becomes the current output window. (See the
window outputstatement to learn how to specify an output window that's different from the active window.)
- A dialog event of type
_wndActivateis generated. (There are also other kinds of actions which generate
_wndActivateevents; see the
dialogfunction for more information.)
- Any previously-active window becomes inactive (this also generates a separate
Alter the Size, Location or Title of an Existing Window
- Visible: specify the (positive) ID number of an existing window in
idExpr. The window also becomes the current active window, and it becomes the current output window.
- Invisible: specify the negative of an existing window's ID number in
idExpr. The window becomes the current output window. If it was the active window, it becomes inactive (possibly forcing another window to become active). Specifying any of the other parameters isn't required to change its visibility, unless the window's other characteristics need changing. Creating a window invisibly, when it contains controls, edit fields and graphics that may take a long time to build, desirably hides the building process from the end user.
- Side effects: If
wNumis negative, the window becomes invisible and the current output window. If it was previously active, it becomes inactive; if the program has other visible windows, one of them becomes the active window.
- Specify the ID number of an existing window (or its negative) in
wNum, and specify a new
rectparameter. Omitted parameters do not change the corresponding characteristic. Unlike its behavior at window creation, specifying (0,0) for the
rectparameter's x,y coordinates does NOT automatically center an existing window; instead the window is moved to those coordinates, which is likely undesirable behavior. To center an existing window( or perform other window positioning without changing its size ) on the screen, just call RepositionWindow():
// new window
window 1, @"the title", fn CGRectMake( 50,100, w, h ) // x, y, width, height
// center existing
fn RepositionWindow( window(_wndRef), NULL, _kWindowCenterOnMainScreen )
The following functions are also available for setting or copying a window's title
WindowSetTitle( SInt32 wndNum, CFStringRef title )sets the window's title bar with the contents of the supplied CFStringRef
fn WindowCopyTitle( SInt32 wndNum ) = CFStringRefcopies the window's title into a CFString. Caller is responsible for releasing the CFStringRef
minwindow, maxwindow, get window, window close, window output, window function, appearance window, dialog function