Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
editable: true
});
var win = elm.realise(elm.Window({
title: "Notify Example",
width: 320,
height: 480,
weight: EXPAND_BOTH,
align: FILL_BOTH,
elements: {
background: elm.Background({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true
}),
box: elm.Box({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true,
elements: {
notify: elm.Notify({
content: entry,
timeout: 5,
align: { x: 0.5, y: 0.0 }
}),
icon_no_scale: elm.Button({
label: "Icon no scale",
weight: { x: -1.0, y: -1.0 },
on_click: function(me) {
print("notify text: " + win.elements.box.elements.notify.content.text);
}
})
var w = elm.Window({
label: "Button demo",
width: 320,
height: 480,
elements: {
the_background: elm.Background({
weight: EXPAND_BOTH,
resize: true
}),
scroll: elm.Scroller({
bounce: { x: false, y: true },
policy: { x: "off", y: "auto" },
weight: EXPAND_BOTH,
resize: true,
content: elm.Box({
weight: EXPAND_BOTH,
elements: {
icon_button: elm.Button({
icon: logo_icon,
label: "Icon sized to button",
weight: { x: -1.0, y: -1.0 },
on_click: function(arg) {
print("clicked event on Button: 1 " + this.label);
},
on_unpressed: function(arg) {
print("unpressed event on Button: 1" + this.label);
},
}),
icon_no_scale: elm.Button({
icon: logo_icon_unscaled,
label: "Icon no scale",
var calc = elm.realise(elm.Window({
title : "Calculator demo",
elements : {
the_background : elm.Background ({
weight : EXPAND_BOTH,
resize : true,
}),
vbox : elm.Box ({
resize : true,
elements : {
entry : elm.Entry ({
label : "0",
align : { x : -1, y : 0 },
}),
hbox1 : elm.Box ({
horizontal : true,
homogeneous : true,
elements : {
b7 : number_button("7"),
b8 : number_button("8"),
b9 : number_button("9"),
divide : op_button("/", divide),
},
}),
hbox2 : elm.Box ({
horizontal : true,
homogeneous : true,
elements : {
b4 : number_button("4"),
b5 : number_button("5"),
b6 : number_button("6"),
elements : {
entry : elm.Entry ({
label : "0",
align : { x : -1, y : 0 },
}),
hbox1 : elm.Box ({
horizontal : true,
homogeneous : true,
elements : {
b7 : number_button("7"),
b8 : number_button("8"),
b9 : number_button("9"),
divide : op_button("/", divide),
},
}),
hbox2 : elm.Box ({
horizontal : true,
homogeneous : true,
elements : {
b4 : number_button("4"),
b5 : number_button("5"),
b6 : number_button("6"),
multiply : op_button("*", multiply),
},
}),
hbox3 : elm.Box ({
horizontal : true,
homogeneous : true,
elements : {
b1 : number_button("1"),
b2 : number_button("2"),
b3 : number_button("3"),
b5 : number_button("5"),
b6 : number_button("6"),
multiply : op_button("*", multiply),
},
}),
hbox3 : elm.Box ({
horizontal : true,
homogeneous : true,
elements : {
b1 : number_button("1"),
b2 : number_button("2"),
b3 : number_button("3"),
subtract : op_button("-", subtract),
},
}),
hbox4 : elm.Box ({
horizontal : true,
homogeneous : true,
elements : {
b0 : number_button("0"),
bdot : number_button("."),
equals : elm.Button ({
type : "button",
label : "=",
weight : { x : -1.0, y : -1.0 },
on_click : function () {
push_entry();
set_entry("");
var answer = evaluate();
set_entry(answer);
clear = 1;
},
}
}),
priority: 400
},
{ separator: true },
{
icon: 'go-home',
label: 'Home',
priority: 50,
on_select: function() {
window.elements.vbox.elements.webpage.elements.web.uri = HOME_URL;
}
}
]
}),
webpage: elm.Box({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true,
horizontal: true,
elements: {
web: elm.Web({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true,
history_enabled: false,
uri: HOME_URL,
on_title_change: function(title) {
window.title = title;
},
on_load_progress: function(load) {
if (load == 1) {
}[this.label] || orange,
title: this.label
};
}
win = elm.realise(elm.Window({
title: "Naviframe Example",
width: 320,
height: 480,
elements: {
background: elm.Background({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true
}),
box: elm.Box({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true,
elements: {
naviframe: elm.Naviframe({
weight: EXPAND_BOTH,
align: FILL_BOTH,
elements: {},
resize: true
}),
but_box: elm.Box({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true,
horizontal: true,
elements: {
});
var logo_icon_unscaled = elm.Icon({
image: elm.datadir + "data/images/logo_small.png",
resizable_up: false,
resizable_down: false
});
var w = elm.Window({
title: "Check box demo",
elements: {
the_background: elm.Background({
weight: EXPAND_BOTH,
resize: true
}),
the_box: elm.Box({
weight: EXPAND_BOTH,
resize: true,
elements: {
icon_sized_check: elm.Check({
icon: logo_icon,
label: "Icon sized to check",
weight: { x: -1.0, y: -1.0 },
align: { x: -1.0, y: 0.5 },
state: true
}),
toggle1: elm.Check({
style: "toggle",
icon: logo_icon,
label: "Spades",
onlabel: "Numbers",
offlabel: "Alphabets",
var EXPAND_BOTH = {x: 1.0, y: 1.0};
var FILL_BOTH = {x: -1.0, y: -1.0};
var win = elm.realise(elm.Window({
label: "Date Time Demo",
width: 320,
height: 480,
align: FILL_BOTH,
elements: {
background: elm.Background({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true
}),
box: elm.Box({
weight: EXPAND_BOTH,
resize: true,
elements: {
dubai: elm.DateTime({
weight: EXPAND_BOTH,
align: FILL_BOTH,
value_min: {
sec: 12,
min: 59,
hour: 11,
dayofmonth: 3,
month: 1,
year: 1978,
dayofweek: 0,
daysinyear: 12
},
}),
last_name : elm.Entry ({
text : "Last Name",
weight : EXPAND_BOTH,
align : FILL_BOTH,
line_wrap : 3,
editable : true,
}),
phone_number : elm.Entry ({
text : "Phone Number",
weight : EXPAND_BOTH,
align : FILL_BOTH,
line_wrap : 3,
editable : true,
}),
but_box: elm.Box({
horizontal: true,
elements: {
save: elm.Button({
label: "Save ",
weight: EXPAND_BOTH,
on_click: function() { saveItems(); }
}),
load: elm.Button({
label: "Load",
weight: EXPAND_BOTH,
on_click: function() { loadItems(); }
}),
clear: elm.Button({
label: 'Clear',
weight: EXPAND_BOTH,
on_click: function() { clearItems(); }