MAXScript Tools and Interaction with 3ds Max > Creating MAXScript Tools > Scripted Dialogs >

# CreateDialog

| Creating User Interfaces - Quick Navigation

The CreateDialog function lets you turn an existing rollout definition into a floating Dialog.

Other than a RolloutFloater which is a container of one or more rollouts, a Dialog is a special display form of the rollout rollout itself.

It provides advanced features like a modal display option, background bitmap display and mouse event handlers.

The syntax for creating dialogs is:

    CreateDialog <Rollout> [<height> <width> <position_x> <position_y>]\
    [pos:<Point2>] [width:<integer>] [height:<integer>] \
    [bgcolor:<color>] [fgcolor:<color>] \
    [bitmap:<bitmap>] {bmpstyle:<bmpstyle> \
    [menu:<RCMenu>] [style:<array>] [modal:<boolean>] \
    [escapeEnable:<boolean>] [lockHeight:<boolean>] [lockWidth:<boolean>]

When the optional modal:<boolean> keyword is set to true , the dialog ignores all user interactions except those within the dialog. Call DestroyDialog() to close it, presumably in a scripted OK button. The user can also close a modal scripted dialog by hitting the Escape key as long as escapeEnable keyword is set to false or not supplied.

When the optional escapeEnable keyword is set to true, MAXScript escape checker will be disabled for the dialog, preventing the "MaxScript Interrupt" message from appearing.

If the optional lockHeight keyword is true , the height of the dialog cannot be interactively changed. If the optional lockWidth keyword is true , the width of the dialog cannot be interactively changed.

Parameters:

    <Rollout>

The rollout definition to create the dialog from.

    [pos:<Point2>] -- default:dialog will center within MAX.

Placement of the upper left corner of the dialog relative to the upper left corner of the screen.

    [width:<integer>] -- default:200

Width of the dialog box.

    [height:<integer>] -- default:dynamic on control extents

Height of the dialog box.

    [bgcolor:<color>] -- default:(<system button color>)

Background color of the dialog.

    [fgcolor:<color>] -- default:(color 0 0 0)

Forground color of the dialog (static text color)

    [bitmap:<bitmap>] -- default:undefined

Background bitmap for the dialog.

    [bmpstyle:<key>] -- default:#bmp_center

The way that the background bitmap is displayed.

Can be one of the following:

    #bmp_center #bmp_tile #bmp_stretch

    [menu:<RCMenu>] -- default:undefined

Menu that will appear in the title bar area of the dialog.

    [style:<array>] -- default:#(#style_titlebar, #style_border, #style_sysmenu)

Array of style flags, can be one or more of the following:

#style_border: Creates a window with a double border but no title.

#style_titlebar: Creates a dialog with a title bar.

#style_toolwindow: Creates a tool window, which has a title bar and is intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font.

#style_resizing: Creates a window with a thick frame that can be used to size the window.

#style_minimizebox: Creates a window that has a minimize button.

#style_maximizebox: Creates a window that has a maximize button.

#style_sysmenu: Creates a window that has a window menu in its title bar.

#style_sunkenedge: Specifies that a window has a 3D look, in the form of a border with a sunken edge.

NoteIf the style keyword parameter is not specified, the default styles of #style_titlebar , #style_border , #style_sysmenu are used.

Events:

    on <Rollout> open do

Called when the dialog is opening.

    on <Rollout> close do

Called when the dialog is closing.

    on <Rollout> moved <Point2> do

Called when the dialog is being moved.

    on <Rollout> resized <Point2> do

Called when the dialog is being resized.

    on <Rollout> mousemove <Point2> do

Called when the mouse is being moved within the dialogs client area.

    on <Rollout> lbuttondown <Point2> do

Called when the left mouse button is pressed down within the dialog.

    on <Rollout> lbuttonup <Point2> do

Called when the left mouse button is released.

    on <Rollout> lbuttondblclk <Point2> do

Called when left mouse button is double clicked within the dialog.

    on <Rollout> mbuttondown <Point2> do

Called when middle mouse button is pressed down within the dialog.

    on <Rollout> mbuttonup <Point2> do

Called when the middle mouse button is released.

    on <Rollout> mbuttondblclk <Point2> do

Called when middle mouse button is double clicked within the dialog.

    on <Rollout> rbuttondown <Point2> do

Called when right mouse button is pressed down within the dialog.

    on <Rollout> rbuttonup <Point2> do

Called when the right mouse button is released.

    on <Rollout> rbuttondblclk <Point2> do

Called when right mouse button is double clicked within the dialog.

Note

The <Point2> value passed to the event handlers is the position of the mouse within the dialog client window. A value of [0,0] corresponds to the top left corner of the client window. The top left corner of the dialog window

Associated Methods

    <Point2>GetDialogPos <Rollout>

Returns the position of the Dialog built from the rollout relative to the upper left corner of the screen in Point2 format.

    SetDialogPos <Rollout> <Point2>

Sets the position of the dialog built from the rollout relative to the upper left corner of the screen.

Rollout: The rollout used to build the Dialog.

Point2: Position where the Dialog is placed.

    <Point2>GetDialogSize <rollout>

Returns the size of the window's client area. Equivalent to point2 <rollout>.width <rollout>.heigh

    SetDialogBitmap <rollout> <bitmap>

Sets the bitmap background for the dialog associated with the rollout. If the rollout is not in a dialog, no action is taken. A value of 'undefined' for the bitmap will clear the current bitmap.

    <bitmap>GetDialogBitmap <rollout>

Gets the bitmap background for the dialog associated with the rollout. If the rollout is not in a dialog, 'undefined' is returned

#### See Also

- DestroyDialog

- GetDialogPos and SetDialogPos

- MAXScript Dialogs and Rollout Floaters as Extended viewports