-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhello6.js
38 lines (36 loc) · 1.34 KB
/
hello6.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Complex View with container controls and styling
//
exports.InitializeViewModel = function(context, session) {
return {
firstName: "Jane",
lastName: "Smith",
}
}
exports.View =
{
title: "Hello World 6",
elements:
[
{ control: "text", value: "Enter your name:", font: { bold: true } },
{ control: "stackpanel", orientation: "Horizontal", contents: [
{ control: "text", value: "First name:", verticalAlignment: "Center", width: 200 },
{ control: "edit", binding: "firstName", verticalAlignment: "Center", width: 240 },
] },
{ control: "stackpanel", orientation: "Horizontal", contents: [
{ control: "text", value: "Last name:", verticalAlignment: "Center", width: 200 },
{ control: "edit", binding: "lastName", verticalAlignment: "Center", width: 240 },
] },
{ control: "text", value: "eval('Hello ' + ({firstName} + ' ' + {lastName}).toUpperCase())" },
{ control: "button", caption: "Submit", binding: "onSubmit", enabled: "eval({firstName} && {lastName})" },
]
}
exports.Commands =
{
onSubmit: function(context, session, viewModel)
{
Synchro.showMessage(context, {
title: "Hello World",
message: "User name: " + viewModel.firstName + " " + viewModel.lastName
});
}
}