TextBox Control Example

This example explains how to create a simple window with TextBox controls, bind to the data and show on the screen.

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

UI Model

{
    "windows": [
        {
            "name": "TextBoxExample",
            "title": "TextBox Example",
            "left": 500,
            "top": 100,
            "width": 400,
            "height": 300,
            "controls": [
                {
                    "name": "firstNameTextBox",
                    "type": "textbox",
                    "label": "First Name",
                    "bindsTo": "firstName"
                },
                {
                    "name": "lastNameTextBox",
                    "type": "textbox",
                    "label": "Last Name",
                    "bindsTo": "lastName"
                },
                {
                    "name": "OKButton",
                    "type": "button",
                    "text": "OK",
                    "isDialogButton": true,
                    "dialogResult": "OK"
                },
                {
                    "name": "CancelButton",
                    "type": "button",
                    "text": "Cancel",
                    "isDialogButton": true,
                    "dialogResult": "Cancel"
                }
            ]
        }
    ]
}

Data Model

var playerData = {
    firstName: "Claudio",
    lastName: "Lucchesi",
};

Code

var exampleWindow = redui.createNewWindow("TextBoxExample");
exampleWindow.bind(playerData);
exampleWindow.show();


.

Last edited Nov 21, 2013 at 9:09 AM by artemkv, version 7

Comments

No comments yet.