M-Files UI Extensibility Framework
Showing Message Boxes
M-Files UI Extensibility Framework > Technical Articles > Showing Message Boxes

Simple and customized message boxes can be displayed in various interfaces by using ShowMessage method. This method can take either single string or object as a parameter. If an object is passed, it defines the behavior of the message box.

The code below shows two message boxes, one with just basic text, and another with two option buttons.

// Here the shellFrame refers to IShellFrame object.

 

// Simple message.

shellFrame.ShowMessage( "Hello" );

 

// Customized message with two input buttons.

var clickedButton = shellFrame.ShowMessage(

    {

        caption: "MyApp",

        message: "Quit or Continue?",

        icon: "question",

        button1_title: "Quit",

        button2_title: "Continue",

        defaultButton: 2,

        timeOutButton: 1,

        timeOut: 15

    } );

 

The message boxes look like this:

Description: Description: C:\Users\metari\Documents\wwwpage\DevGuide_files\image013.jpg               Description: Description: C:\Users\metari\Documents\wwwpage\DevGuide_files\image014.jpg

The list below explains supported attributes.                                                    

Name

Type

In/Out

Value

Default

caption

String

in

The message window caption text

"M-Files"

message

String

in

The message window content text

<empty>

icon

String

in

One "error", "warning", "information" or "question"

"warning"

button1_title

String

in

Button 1 title

Ok

button1_enabled

Boolean

in

Button 1 enabled state

true

button2_title

String

in

Button 2 title

<empty>

button2_enabled

Boolean

in

Button 2 enabled state

true

button3_title

String

in

Button 3 title

<empty>

button3_enabled

Boolean

in

Button 3 enabled state

true

button4_title

String

in

Button 4 title

<empty>

button4_enabled

Boolean

in

Button 4 enabled state

true

defaultButton

Number

in

The index of the default button, 1-4

1

cancelButton

Number

in

The index of the cancel button, 1-4

0 (no cancel)

timeOutButton

Number

in

The index of the button that is activated on timeout, 1-4

0

timeOut

Number

in

Automatic dialog close timeout in seconds, 1..n seconds 

0

timeout_deactivateOnFocusChange

Boolean

in

True if the timer ceases when the focus in the message box changes

true

checkbox_title

String

in

The checkbox title

<empty>

checkbox_enabled

Boolean

in

True if the checkbox is enabled (i.e. not grayed)

true

checkbox_checked

Boolean

in/out

On input: True if the checkbox is initially checked. On output: receives true if the checkbox is checked by the user.

false


See Also