|
Anthony
|
 |
« Reply #4 on: August 17, 2011, 04:24:11 AM » |
|
typical example see button code at the end.
// The default code is a com class (inherited from linb.Com) Class('App', 'linb.Com',{ // Ensure that all the value of "key/value pair" does not refer to external variables Instance:{ // To initialize instance(e.g. properties) initialize : function(){ // To determine whether or not the com will be destroyed, when the first UI control be destroyed this.autoDestroy = true; // To initialize properties this.properties = {}; }, // To initialize internal components (mostly UI controls) // *** If you're not a skilled, dont modify this function manually *** iniComponents : function(){ // [[code created by jsLinb UI Builder var host=this, children=[], append=function(child){children.push(child.get(0))}; append( (new linb.UI.Input) .setHost(host,"ctl_input12") .setLeft(130) .setTop(540) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input12") ); append( (new linb.UI.SButton) .setHost(host,"ctl_sbutton1") .setLeft(30) .setTop(30) .setCaption("click me") .onClick("_ctl_sbutton1_onclick") ); append( (new linb.UI.Label) .setHost(host,"ctl_label1") .setLeft(30) .setTop(80) .setCaption("ctl_label1") ); append( (new linb.UI.Label) .setHost(host,"ctl_label2") .setLeft(40) .setTop(100) .setCaption("ctl_label2") ); append( (new linb.UI.Label) .setHost(host,"ctl_label3") .setLeft(60) .setTop(130) .setCaption("ctl_label3") ); append( (new linb.UI.Label) .setHost(host,"ctl_label4") .setLeft(90) .setTop(160) .setCaption("ctl_label4") ); append( (new linb.UI.Label) .setHost(host,"ctl_label5") .setLeft(80) .setTop(180) .setCaption("ctl_label5") ); append( (new linb.UI.Label) .setHost(host,"ctl_label6") .setLeft(110) .setTop(200) .setCaption("ctl_label6") ); append( (new linb.UI.Input) .setHost(host,"ctl_input2") .setLeft(30) .setTop(220) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input2") ); append( (new linb.UI.Input) .setHost(host,"ctl_input3") .setLeft(60) .setTop(250) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input3") ); append( (new linb.UI.Input) .setHost(host,"ctl_input4") .setLeft(20) .setTop(280) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input4") ); append( (new linb.UI.Input) .setHost(host,"ctl_input5") .setLeft(20) .setTop(310) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input5") ); append( (new linb.UI.Input) .setHost(host,"ctl_input6") .setLeft(50) .setTop(340) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input6") ); append( (new linb.UI.Input) .setHost(host,"ctl_input7") .setLeft(40) .setTop(370) .setHeight(44) .setLabelSize(20) .setLabelPos("top") .setLabelCaption("ctl_input7") .setLabelHAlign("left") ); append( (new linb.UI.Input) .setHost(host,"ctl_input8") .setLeft(70) .setTop(430) .setHeight(44) .setLabelSize(20) .setLabelPos("top") .setLabelCaption("ctl_input8") .setLabelHAlign("left") ); append( (new linb.UI.Input) .setHost(host,"ctl_input9") .setLeft(190) .setTop(400) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input9") ); append( (new linb.UI.Input) .setHost(host,"ctl_input10") .setLeft(20) .setTop(490) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input10") ); append( (new linb.UI.Input) .setHost(host,"ctl_input11") .setLeft(310) .setTop(460) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input11") ); append( (new linb.UI.Link) .setHost(host,"ctl_link2") .setLeft(40) .setTop(60) .setCaption("ctl_link2") ); append( (new linb.UI.Input) .setHost(host,"ctl_input13") .setLeft(300) .setTop(50) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input13") ); append( (new linb.UI.Input) .setHost(host,"ctl_input14") .setLeft(330) .setTop(100) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input14") ); append( (new linb.UI.Input) .setHost(host,"ctl_input15") .setLeft(410) .setTop(130) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input15") ); append( (new linb.UI.Input) .setHost(host,"ctl_input16") .setLeft(380) .setTop(180) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input16") ); append( (new linb.UI.Input) .setHost(host,"ctl_input17") .setLeft(400) .setTop(220) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input17") ); append( (new linb.UI.Input) .setHost(host,"ctl_input18") .setLeft(460) .setTop(240) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input18") ); append( (new linb.UI.Input) .setHost(host,"ctl_input19") .setLeft(450) .setTop(270) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input19") ); append( (new linb.UI.Input) .setHost(host,"ctl_input20") .setLeft(520) .setTop(300) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input20") ); append( (new linb.UI.Input) .setHost(host,"ctl_input21") .setLeft(490) .setTop(320) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input21") ); append( (new linb.UI.Input) .setHost(host,"ctl_input22") .setLeft(520) .setTop(350) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input22") ); append( (new linb.UI.ComboInput) .setHost(host,"ctl_comboinput2") .setLeft(510) .setTop(370) .setLabelCaption("ctl_comboinput2") .setItems([{"id":"a", "caption":"item a", "image":"img/demo.gif"}, {"id":"b", "caption":"item b", "image":"img/demo.gif"}, {"id":"c", "caption":"item c", "image":"img/demo.gif"}, {"id":"d", "caption":"item d", "image":"img/demo.gif", "disabled":true}]) ); append( (new linb.UI.ComboInput) .setHost(host,"ctl_comboinput3") .setLeft(580) .setTop(390) .setLabelCaption("ctl_comboinput3") .setItems([{"id":"a", "caption":"item a", "image":"img/demo.gif"}, {"id":"b", "caption":"item b", "image":"img/demo.gif"}, {"id":"c", "caption":"item c", "image":"img/demo.gif"}, {"id":"d", "caption":"item d", "image":"img/demo.gif", "disabled":true}]) ); append( (new linb.UI.Input) .setHost(host,"ctl_input23") .setLeft(610) .setTop(420) .setWidth(240) .setLabelSize(120) .setLabelCaption("ctl_input23") ); append( (new linb.UI.Label) .setHost(host,"ctl_label7") .setLeft(570) .setTop(30) .setCaption("ctl_label7") ); append( (new linb.UI.Label) .setHost(host,"ctl_label8") .setLeft(620) .setTop(60) .setCaption("ctl_label8") ); append( (new linb.UI.Label) .setHost(host,"ctl_label9") .setLeft(650) .setTop(80) .setCaption("ctl_label9") ); append( (new linb.UI.SCheckBox) .setHost(host,"ctl_scheckbox1") .setLeft(700) .setTop(110) .setCaption("ctl_scheckbox1") ); append( (new linb.UI.Label) .setHost(host,"ctl_label10") .setLeft(670) .setTop(150) .setCaption("ctl_label10") ); return children; // ]]code created by jsLinb UI Builder }, // Give a chance to load other com iniExComs : function(com, threadid){ }, // Give a chance to determine which UI controls will be appended to parent container customAppend : function(parent, subId, left, top){ // "return false" will cause all the internal UI controls will be added to the parent panel return false; }, // This instance's events events : {}, _ctl_sbutton1_onclick : function (profile, e, src, value) { var uictrl = profile.boxing(); var me = this; me.ctl_label1.setCaption("test"); // This one shows the intellisense // me.ctl_label10. //This One does NOT show intellisense linb.alert("hi","I'm " + uictrl.getAlias()); } } });
|