how to implement a simple function which adds two values

Develop and Deploy Cross-Browser Web Apps .

how to implement a simple function which adds two values

Postby support » Sat Mar 03, 2018 10:22 am

   
xui.Class('App', 'xui.Module',{
Instance:{
iniComponents : function(){
// [[Code created by CrossUI RAD Studio
var host=this, children=[], append=function(child){children.push(child.get(0));};

append(
xui.create("xui.UI.SVGPaper")
.setHost(host,"xui_ui_svgpaper1")
.setLeft("15.833333333333334em")
.setTop("5em")
.setWidth("48.666666666666664em")
.setHeight("18.333333333333332em")
.setZIndex(0)
);

host.xui_ui_svgpaper1.append(
xui.create("xui.svg.path")
.setHost(host,"xui_svg_path3")
.setSvgTag("Arrow:7")
.setAttr({
"path":"M,528,78L,527,181L,331,182L,329.9200279347008,166.55997650455294L,259.84006495363445,183.3599778102984L,329.9200279347008,200.15998716973706L,329.9200279347008,191.75998249001776L,540.1599732576195,191.75998249001776L,541,79Z",
"stroke":"#004A7F",
"fill":"#ffffff",
"stroke-width":2
})
);

append(
xui.create("xui.UI.ComboInput")
.setHost(host,"i_A1")
.setDirtyMark(false)
.setLeft("11.666666666666666em")
.setTop("5.833333333333333em")
.setWidth("25em")
.setLabelSize("18em")
.setLabelCaption("Set excelCellId to 'A1'")
.setType("number")
.setExcelCellId("A1")
.setPrecision(0)
.setValue(1)
);

append(
xui.create("xui.UI.ComboInput")
.setHost(host,"i_A2")
.setDirtyMark(false)
.setLeft("11.666666666666666em")
.setTop("9.166666666666666em")
.setWidth("25em")
.setLabelSize("18em")
.setLabelCaption("Set excelCellId to 'A1'")
.setType("number")
.setExcelCellId("A2")
.setPrecision(0)
.setValue(2)
);

append(
xui.create("xui.UI.ComboInput")
.setHost(host,"i_A3")
.setReadonly(true)
.setDirtyMark(false)
.setLeft("39.166666666666664em")
.setTop("9.166666666666666em")
.setWidth("25em")
.setLabelSize("18em")
.setLabelCaption("Set excelCellFormula to \"=A1+A2\"")
.setType("number")
.setExcelCellFormula("=A1+A2")
.setPrecision(0)
);

append(
xui.create("xui.UI.ComboInput")
.setHost(host,"i_result")
.setDirtyMark(false)
.setLeft("11.666666666666666em")
.setTop("19.166666666666668em")
.setWidth("25em")
.setLabelSize("18em")
.setLabelCaption("Show result")
.setType("number")
.setPrecision(0)
);

append(
xui.create("xui.UI.Button")
.setHost(host,"xui_ui_button22")
.setDirtyMark(false)
.setLeft("45em")
.setTop("12.5em")
.setWidth("13.75em")
.setHeight("7em")
.setCaption("Use Formula")
.onClick([
{
"desc":"Action 1",
"type":"control",
"target":"i_result",
"args":[
"{page.i_result.setUIValue()}",
undefined,
undefined,
"{page.i_A3.getValue()}"
],
"method":"setUIValue",
"redirection":"other:callback:call",
"event":1
}
])
);

append(
xui.create("xui.UI.Label")
.setHost(host,"xui_ui_label27")
.setClassName("xui-css-qv")
.setLeft("22.5em")
.setTop("26.666666666666668em")
.setWidth("14.916666666666666em")
.setHeight("2em")
.setCaption("Use Function")
.setHAlign("center")
.setFontSize("1.5em")
.onClick([
{
"desc":"fun",
"type":"other",
"target":"var",
"args":[
"add",
function anonymous(v1,
v2
/*``*/
){
return+v1+ +v2;
}
],
"method":"temp",
"event":1
},
{
"desc":"calculate",
"type":"other",
"target":"callback",
"args":[
"{temp.add}",
"temp",
"result",
"{page.i_A1.getValue()}",
"{page.i_A2.getValue()}"
],
"method":"call"
},
{
"desc":"alert",
"type":"other",
"target":"msg",
"args":[
"A1+A2 = ?",
"{temp.result}"
],
"method":"pop"
}
])
);

append(
xui.create("xui.UI.CSSBox")
.setHost(host,"xui_ui_cssbox3")
.setClassName("xui-css-qv")
.setNormalStatus({
"color":"#eeeeee",
"border-radius":"6px",
"box-shadow":"inset 0px 1px 0px #87C1DD",
"text-shadow":"none",
"$gradient":{
"stops":[
{
"pos":"0%",
"clr":"#3289B2"
},
{
"pos":"100%",
"clr":"#3899C6 "
}
],
"type":"linear",
"orient":"T"
},
"cursor":"pointer",
"border-top":"solid #3899C6 1px",
"border-right":"solid #3899C6 1px",
"border-bottom":"solid #3899C6 1px",
"border-left":"solid #3899C6 1px"
})
);

return children;
// ]]Code created by CrossUI RAD Studio
}
}
});
   
support
 
Posts: 350
Joined: Sat Apr 27, 2013 9:22 am

Return to CrossUI for Web Apps

Who is online

Users browsing this forum: No registered users and 0 guests