Futurebasic/Language/Reference/appearance window
Appearance Window
Statement
✔ Appearance χ Standard χ Console
Syntax
appearance window [#][-] id&[, [title$][, [rect][, ¬
[windowClass][, [windowAttributes] [, [FBAttributes]]]]]]
Revised
Feb 2002 (Release 6)
Description
Use this statement to do any of the following:
- Create a new screen window;
- Activate (highlight and bring to the front) an existing window;
- Make an existing window visible or invisible;
- Alter the title or rectangle of an existing window.
The appearance window statement closely follows the older window statement, but is used primarily for the creation of windows. You may freely mix window functions and window statements with windows that are created via the appearance window statement. For instance, after creating a window with the appearance window statement, you could determine its size with the window( _width ) and window( _height ) functions.
You may notice that windows in most modern applications have a background that is something other than white. This is not accomplished by drawing into the window with graphic commands. It is put in place with a simple call to the Theme Manager. The following line will be useful in many programs.
def SetWindowBackground( _kThemeActiveDialogBackgroundBrush, _zTrue )
| <img src="a/appearancewindow01.gif" alt="" height="98" width="311"> |
| <img src="a/appearancewindow02.gif" alt="" height="98" width="312"> |
|
Windows with and without theme backgrounds |
The parameters for appearance window should be specified as follows. They are interpreted slightly differently depending on whether you are creating a new window or altering an existing one.
id- a positive or negative integer whose absolute value is in the range 1 through 2147483647.title$- a string expression.rect- a rectangle in global screen coordinates. You can express it in either of two forms:(x1,y1)-(x2,y2)Two diagonally opposite corner points. @rectAddr&Long integer expression or pointervariable which points to an 8-byte struct such as aRecttypewindowClass- an unsigned long integer that specifies the Macintosh window class. This is not the same value as FB's user definable class for the standard runtime. It more closely represents the layer in which a window will reside. To create awindowClassvariable use the following syntax:dim wc as WindowClass
The
windowClasstable introduces some new terms which may not be familiar to those new to OS X.<img src="a/appearancewindow03.gif" alt="" height="67" width="237"> Window with toolbar
A sheet window is attached to a parent window. It drops from the title bar of the parent and is used to force some decision relative to the parent window.
<img src="a/appearancewindow04.gif" alt="" height="159" width="197"> Sheet windowwindowClass ValueDescription _kAlertWindowClass1I need your attention now. _kMovableAlertWindowClass2I need your attention now, but I'm kind enough to let you switch out of this app to do other things _kModalWindowClass3system modal, not draggable _kMovableModalWindowClass4application modal, draggable _kFloatingWindowClass5floats above all other application windows. Available in OS 8.6 or later _kDocumentWindowClass6document windows _kDesktopWindowClass7the desktop _kHelpWindowClass10help windows _kSheetWindowClass11sheets _kToolbarWindowClass12floats above docs, below floating windows _kPlainWindowClass13plain _kOverlayWindowClass14overlays _kSheetAlertWindowClass15sheet alerts _kAltPlainWindowClass16plain alerts
FBAttributes- this long integer sets up handling procedures that are used by the runtime. Some of the features used in the Standard BASIC runtime are not carried forward for the Appearance Runtime. For example,_noAutoClipis not used because there is no such thing asautoclipin Appearance.
Constant Value FB Attribute _updateVisRgn2048 This attribute affects how the window’s clip region will be set when FutureBASIC calls your dialog-event handling routine with a _wndRefreshevent. If you specify this attribute, the clip region will be set to include only that part of the window which was identified as actually needing a refresh (the clip region will be reset to its previous value when the routine exits). If you omit this attribute, the clip region will be set to include the entire window (possibly excluding controls, edit fields, etc.)_clickThru4096 This attribute affects what happens when your program activates the window in response to a _wndClickevent. If the_clickThruattribute is set, the activating click will be “passed through” to the window; this may cause other events (such as_btnClickor_efClick) to be generated, depending on what was clicked on. If you omit this attribute, two separate clicks are required to activate the window and to interact with its contents._noAutoFocus32768 Use this attribute to prevent the tab key from advancing the keyboard focus in edit fields _keepInactive65536 This attributes insures that the window will never be activated. Controls in the window will not function If you bring the window forward under program control ( WINDOWstatement) it will behave normally. This type of window is intended for use as a backdrop.
To Create a New Screen Window
- Specify an
idvalue such thatabs( id )is different from the ID number of any existing window. A new window is created and is assigned an ID number ofABS(id). You can use the window's ID number later to identify the window in other FB statements and functions. Ifidis negative, the window is created invisibly; it's sometimes useful to create a window invisibly if it will contain controls, edit fields and graphics that may take a long time to build. You can use thewindowstatement again to make an invisible window visible (see below). When you create a new window, it becomes the current output window. If you create it visibly (and you don't specify the_keepInBackattribute), it also becomes the current active window. title$assigns a string to the window's title bar (if the window has a title bar). If you omit this parameter, the window will be created without a title.rectspecifies the initial size and location of the window's content rectangle. Note thatrectdoes not include the window's frame. This parameter is interpreted in a special way if you specify an upper-left coordinate of (0,0) inrect; in this case, the window is centered in the screen, and its width and height are determined by the right and bottom coordinates ofrect. Note that this special interpretation applies only when you're creating a new window. If you omit this parameter, a window of a "default" size and location is created.windowClassspecifies the layer in which a window will reside.windowAttributesspecifies the types of window widgets (close box, grow box) that a window will include.FBAttributesspecifies runtime handling parameters that determine how the window will behave.
Notes
No special notes.
See Also
def TransitionRect; def WindowCategory; MinWindow; MaxWindow; SetZoom; get window; window close; window output; window function; dialog function