DIALOG

nameID DIALOG [load-option] [mem-option] x, y, width, height
BEGIN
control-statements
.
.
.
END

The DIALOG statement defines a window that an application can use to create dialog boxes. The statement defines the position and dimensions of the dialog box on the screen as well as the dialog box style.

Parameters

nameID

Identifies the dialog box. This is either a unique name or a unique integer value in the range 1 to 65,535.

load-option

Specifies when the resource is to be loaded. This parameter is optional. If it is specified, it must be one of the following:

Option Description

PRELOAD Resource is loaded immediately.
LOADONCALL Resource is loaded when called. This is the default option.

mem-option

Specifies whether the resource is fixed or movable and whether it is discardable. This parameter is optional. If it is specified, it must be either FIXED or MOVEABLE. An additional value, DISCARDABLE may also be specified. The following list describes the options in more detail:

Option Description

FIXED Resource remains at a fixed memory location.
MOVEABLE Resource can be moved if necessary in order to compact memory. This is the default option.
DISCARDABLE Resource can be discarded if no longer needed.

x

Specifies the x-coordinate of the left side of the dialog box. This value must be an integer in the range 0 through 65,535 or an expression consisting of integers and the addition (+) or subtraction (–) operator. The coordinate is assumed to be in dialog units.

y

Specifies the y-coordinate of the top side of the dialog box. This value must be an integer in the range 0 through 65,535 or an expression consisting of integers and the addition (+) or subtraction (–) operator. The coordinate is assumed to be in dialog units.

width

Specifies the width of the dialog box. This value must be an integer in the range 1 through 65,535 or an expression consisting of integers and the addition (+) or subtraction (–) operator. The width is in 1/4-character units.

height

Specifies the height of the dialog box. This value must be an integer in the range 1 through 65,535 or an expression consisting of integers and the addition (+) or subtraction (–) operator. The height is in 1/8-character units.

style

Specifies the dialog box styles.

Comments

The GetDialogBaseUnits function returns the dialog base units in pixels. The exact meaning of the coordinates depends on the style defined by the STYLE option statement. For child-style dialog boxes, the coordinates are relative to the origin of the parent window, unless the dialog box has the style DS_ABSALIGN; in that case, the coordinates are relative to the origin of the display screen.

Do not use the WS_CHILD style with a modal dialog box. The DialogBox function always disables the parent/owner of the newly created dialog box. When a parent window is disabled, its child windows are implicitly disabled. Since the parent window of the child-style dialog box is disabled, the child-style dialog box is too.

If a dialog box has the DS_ABSALIGN style, the dialog coordinates for its upper-left corner are relative to the screen origin instead of to the upper-left corner of the parent window. You would typically use this style when you wanted the dialog box to start in a specific part of the display no matter where the parent window may be on the screen.

The name DIALOG can also be used as the class-name parameter to the CreateWindow function to create a window with dialog box attributes.

Examples

The following demonstrates the usage of the DIALOG statement:

#include <windows.h>

ErrorDialog DIALOG  10, 10, 300, 110
STYLE WS_POPUP|WS_BORDER
CAPTION "Error!"


BEGIN
    CTEXT "Select One:", 1, 10, 10, 280, 12
    PUSHBUTTON "&Retry", 2, 75, 30, 60, 12
    PUSHBUTTON "&Abort", 3, 75, 50, 60, 12
    PUSHBUTTON "&Ignore", 4, 75, 80, 60, 12
END

See Also

CreateWindow, DialogBox, GetDialogBaseUnits