Hello, my proposal to you would be to declare them in the main function, and pass them as parameters to the makeCopiesArea,makeStatusBar and createBox1 functions.
also, mind that in order for this line: box.add(this.createBox1()); to work , you should return container from createBox1() function. cheers, Gabi ________________________________________ From: Qoodary [[email protected]] Sent: Monday, November 22, 2010 12:47 PM To: [email protected] Subject: [qooxdoo-devel] Variable Handling? Hello, In my application.js I have the Main function and some other functions. >From main function I call function makeCopiesArea, makeStatusBar and createBox1 functions. In my main function I have added a controller To have access from main function to the btnSend, selectBoxColoroption and txtCopies in the other functions, I need to declare this without "var" Is this OK, or is there a better solution? ------------------------------------------------- qx.Class.define("mobile.Application", { extend : qx.application.Standalone, /* ***************************************************************************** MEMBERS ***************************************************************************** */ members : { /** * This method contains the initial application code and gets called * during startup of the application */ main : function() { var mainContainer = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)); this.getRoot().add(mainContainer); mainContainer.add(this.makeCopiesArea()); mainContainer.add(this.makeStatusBar()); var box = new qx.ui.container.Composite(new qx.ui.layout.HBox(10)); box.add(this.createBox1()); mainContainer.add(box); var modelSkeleton = {copies: "1", coloroption: null, hidden: "x"}; var model = qx.data.marshal.Json.createModel(modelSkeleton); // create the controller var controller = new qx.data.controller.Object(model); // connect the copies controller.addTarget(txtCopies, "value", "copies", true); // connect the select box controller.addTarget(selectBoxColoroption, "modelSelection[0]", "coloroption", true); btnSend.addListener("execute", function() { alert("You are sending: " + qx.util.Serializer.toJson(model)); }, this); },//main function makeCopiesArea : function(){ txtCopies = new qx.ui.form.TextField("1").set({ maxLength: 15, textAlign: "center", width: 50, height: 40 }); }, createBox1 : function() { var container = new qx.ui.container.Composite(new qx.ui.layout.VBox(2)); container.add(new qx.ui.basic.Label(this.tr("Coloroption"))); selectBoxColoroption = new qx.ui.form.SelectBox(); }, makeStatusBar : function(){ var container = new qx.ui.container.Composite(new qx.ui.layout.HBox(5)).set({ allowGrowX: false }); btnSend = new qx.ui.form.Button(this.tr("Send"), "icon/32/actions/media-playback-start.png"); container.add(btnSend); return container; } } } -- View this message in context: http://old.nabble.com/Variable-Handling--tp30277359p30277359.html Sent from the qooxdoo-devel mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
