Futurebasic/Language/Reference/appearance window

From Wikibooks, open books for an open world
Jump to navigation Jump to search

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 pointer variable which points to an 8-byte struct such as a Rect type
    • windowClass - 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 a windowClass variable use the following syntax:
      dim wc as WindowClass
      

      The windowClass table 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 window
      windowClass
      Value
      Description
      _kAlertWindowClass
      1
      I need your attention now.
      _kMovableAlertWindowClass
      2
      I need your attention now, but I'm kind enough to let you switch out of this app to do other things
      _kModalWindowClass
      3
      system modal, not draggable
      _kMovableModalWindowClass
      4
      application modal, draggable
      _kFloatingWindowClass
      5
      floats above all other application windows. Available in OS 8.6 or later
      _kDocumentWindowClass
      6
      document windows
      _kDesktopWindowClass
      7
      the desktop
      _kHelpWindowClass
      10
      help windows
      _kSheetWindowClass
      11
      sheets
      _kToolbarWindowClass
      12
      floats above docs, below floating windows
      _kPlainWindowClass
      13
      plain
      _kOverlayWindowClass
      14
      overlays
      _kSheetAlertWindowClass
      15
      sheet alerts
      _kAltPlainWindowClass
      16
      plain 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, _noAutoClip is not used because there is no such thing as autoclip in Appearance.
      Constant Value FB Attribute
      _updateVisRgn 2048 This attribute affects how the window’s clip region will be set when FutureBASIC calls your dialog-event handling routine with a _wndRefresh event. 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.)
      _clickThru 4096 This attribute affects what happens when your program activates the window in response to a _wndClick event. If the _clickThru attribute is set, the activating click will be “passed through” to the window; this may cause other events (such as _btnClick or _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.
      _noAutoFocus 32768 Use this attribute to prevent the tab key from advancing the keyboard focus in edit fields
      _keepInactive 65536 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 (WINDOW statement) it will behave normally. This type of window is intended for use as a backdrop.

    To Create a New Screen Window

    • Specify an id value such that abs( id ) is different from the ID number of any existing window. A new window is created and is assigned an ID number of ABS(id). You can use the window's ID number later to identify the window in other FB statements and functions. If id is 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 the window statement 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 _keepInBack attribute), 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.
    • rect specifies the initial size and location of the window's content rectangle. Note that rect does not include the window's frame. This parameter is interpreted in a special way if you specify an upper-left coordinate of (0,0) in rect; in this case, the window is centered in the screen, and its width and height are determined by the right and bottom coordinates of rect. 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.
    • windowClass specifies the layer in which a window will reside.
    • windowAttributes specifies the types of window widgets (close box, grow box) that a window will include.
    • FBAttributes specifies 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

    Language Reference