Defining Windows

This section provides the mandatory and optional properties and sample resource file examples for the following window resources:

  • Windows and Dialogs

  • Event Masks

  • Status Bars

The Resource Properties Index identifies and describes the optional properties for windows, dialogs, and status bars. The Predefined Constants section identifies and describes the event mask settings.

Windows and Dialogs

Windows serve as the principal resource placeholders. All resources contained within a window are nested within the window's resource file description. A window can also serve as a dialog box.

The following lists the mandatory properties for windows and dialogs:

Window resource-id"title"x, y, width, height

The following describes the window and dialog properties:

Property

Definition

Window

Identifies the resource as a window.

resource-id

Unique resource ID number that identifies the window in the resource file. It must be an integer between 1 and 32767.

"title"

Title of the control, contained in quotation marks.

x

Horizontal position of the upper-left corner of the control in current units.

y

Vertical position of the upper-left corner of the control in current units.

width

Width of the control in current units.

height

Height of the control in current units.

Example

The following example contains three windows: the first contains only the mandatory definitions, the second contains dialog box settings, and the third contains optional settings.


VERSION "4.01"

WINDOW 1 "First Window" 0 0 200 100

BEGIN

END

WINDOW 2 "Second Window" 0 0 200 100

BEGIN

    ALWAYSONTOP

    BACKGROUNDCOLOR RGB(15,15,5)

    CURRENTUNITS 0

    DEFAULTFONT "Serif" 14,bold italic, CS_DEFAULT

    DIALOGBEHAVIOR

    DIALOGBORDER

    EVENTMASK 1996

    FOREGROUNDCOLOR RGB(1,7,12)

    GRAVITY

    KEYBOARDNAVIGATION

    NOT MINIMIZABLE

    NAME "Dialog Box"

    NOT SIZABLE

    BUTTON 1, "OK", 10, 10, 50, 25

    BEGIN

    END

END

WINDOW 3 "Third Window" 0 0 200 100

BEGIN

    BUTTON 1, "OK", 10, 10, 50, 25

    BEGIN

    END

    CHECKBOX 2, "Done", 10, 10, 50, 25

    BEGIN

    END

END

Current Units Settings

Setting the current units determines the unit type for a window and its contained controls and elements. This is set at the window level only. Use the following settings rather than the numbers contained in the stdincl.h file:

Unit Type

Current Unit Setting

Pixels

currentunits UNITS_PIXELS

Characters

currentunits UNITS_CHARS

Semicharacters

currentunits UNITS_SEMICHARS

Dialog Box Settings

Setting the following properties defines a window as a dialog box:

Alwaysontop,Dialogbehavior,Dialogborder,Gravity,Keyboardnavigation,Not Maximizable, and Not Sizable.

Event Masks

Event masks filter the events reported by the current window. To prompt the window to report only specific events, all events, or a combination of events, use the logical operators "|" (OR), "~" (NOT), "&" (AND), and parentheses to group elements of the expression. Predefined Constants identifies and describes the event mask settings.

Example

The following contains two examples that illustrate event mask properties. The first example defines three individual event masks, while the second defines all events except mouse events.

VERSION "4.01"

// Window Example 1

WINDOW 1 "Order Main Window" 50 250 250 125

BEGIN

  // Only focus, window resize, and mouse move events

  EVENTMASK (EM_FOCUS | EM_SIZE | EM_MOUSEMOVE)

END

// Window Example 2

WINDOW 2 "Order Secondary Window" 350 250 250 125

BEGIN

  // All events except for the mouse events shown

  EVENTMASK EM_ALL & ~(EM_MOUSEDOWN | EM_MOUSEMOVE | EM_MOUSEDOUBLE | EM_MOUSEUP)

END

Status Bars

Status bars are located at the bottom of a window and display information about a process, menu command, or selection.

The following lists the mandatory properties for status bars:

Statusbar control-id

The following describes the scroll bar properties:

Property

Description

Statusbar

Identifies the resource as a status bar.

control-id

An integer between 1 and 32767 that defines the status bar ID number. It must be unique within the top-level window.

Example

The following example contains a window with two status bars: the first contains only the mandatory definitions, while the second also contains optional settings.

VERSION "4.01"

WINDOW 1 "Basic Statusbar Window" 25 25 250 150

BEGIN

    STATUSBAR 5

    BEGIN

    END

END

WINDOW 2 "Fully-Loaded Statusbar Window" 279 25 250 150

BEGIN

    STATUSBAR 6

    BEGIN

        JUSTIFICATION 16384

        BACKGROUNDCOLOR RGB(15,15,5)

        DISABLED

        FONT "Arial" 12, bold

        LONGCUE "Longcue Status Bar Control?"

        NAME "Statbar"

        SHORTCUE "Remarks"

        INVISIBLE

    END

END