This project is read-only.

Custom Modal Dialog Window Example

This example explains how to create a modal dialog window with custom "Yes" and "No" buttons, show on the screen and process the result.

See interactive example on http://www.redui.net

UI Model

{
    "windows": [
        {
            "name": "CustomDialogWindowExample",
            "title": "Custom Dialog Window Example",
            "left": 500,
            "top": 100,
            "width": 400,
            "height": 300,
            "controls": [
                {
                    "name": "infoStaticText",
                    "type": "statictext",
                    "text": "Confirm the action by clicking Yes or No"
                },
                {
                    "name": "YesButton",
                    "type": "button",
                    "text": "Yes",
                    "isDialogButton": true,
                    "dialogResult": "Yes"
                },
                {
                    "name": "NoButton",
                    "type": "button",
                    "text": "No",
                    "isDialogButton": true,
                    "dialogResult": "No"
                }
            ]
        }
    ]
}

Code

var exampleWindow = redui.createNewWindow("CustomDialogWindowExample");
exampleWindow.showModal();

exampleWindow.closed(function (target, dialogResult) {
	if (dialogResult === "Yes") {
		alert("You clicked Yes");
	}
	if (dialogResult === "No") {
		alert("You clicked No");
	}
	if (dialogResult === "Cancel") {
		alert("Closing window this way returns Cancel");
	}
});


.

Last edited Nov 20, 2013 at 12:19 PM by artemkv, version 2

Comments

No comments yet.