Custom Dialog

To present selections or questions the end user will make.

dialog
show a custom dialog on the interface
getFormDialog
create a generic form object to create simple dialogs with 1 or 2 buttons.

examples

// A custom dialog, create a dialog with multiple user input text or item selection
function ShowDialog()
{
    // a JSON form with text, combobox/popup and buttons
    // can add add any needed. at least 1 button is needed (will be added by default if none added).
    var form = {
        "unique_name_01" : {
            "type" : "combobox",
            "default" : "item 3",
            "items" : "item 1,item 2,item 3",
            "label" : "items test:"
        },
        "unique_name_02" : {
            "type" : "text",
            "label" : "instruction text"
        },
        "unique_name_03" : {
            "type" : "textedit",
            "default" : "enter your text here",
            "label" : "text input:",
            "grabfocus" : true
        },
        "unique_name_04" : {
            "type" : "button",
            "label" : "ok",
            "returns" : 1
        },
        "unique_name_05" : {
            "type" : "button",
            "label" : "cancel",
            "returns" : 0
        }
    };

    echo("dialog open");
    var r = dialog("the title", "main message", "w", form);

    // print the return values
    echo("combobox: " + r["unique_name_01"]);
    echo("textedit: " + r.unique_name_03);

    if (r.unique_name_04 == 1) // clicked okay
        echo("dialog okay");
    else if (r.unique_name_05 == 1) // clicked cancel
        echo("dialog cancel");
};