|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
problem to call a variable/widget in other fileHello, I have a problem to call a variable/widget in other file. I would like to retrieval the current value. Here an example: About “testprogram\source\class\testprogram\Application.js” I start the program and call/open a class in “testprogram\source\class\testprogram\Login.js”. In the file “Login.js” is the menu bar. From this bar I call/open other classes and thus other widgets -> for example in “testprogram\source\class\testprogram\preferences\Preferences.js”. How can I from “Preferences.js” query the value of a variable (for example in “Login.js) or change the widget as with the menu bar in “Login.js”? I have tried so much, but just do not find the solution. Can somebody help? Thanks, Martin -- View this message in context: http://n2.nabble.com/problem-to-call-a-variable-widget-in-other-file-tp3212530p3212530.html Sent from the qooxdoo mailing list archive at Nabble.com. ------------------------------------------------------------------------------ _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: problem to call a variable/widget in other fileHas nobody a similar problem? Or is my inquiry not to understand? Or are your programs, always in a single .js-file? I need help...please ;-) Thanks, Martin -- View this message in context: http://n2.nabble.com/problem-to-call-a-variable-widget-in-other-file-tp3212530p3216475.html Sent from the qooxdoo mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/blackberry _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: problem to call a variable/widget in other file> Has nobody a similar problem? Or is my inquiry not to understand?
> Or are your programs, always in a single .js-file? Are your variables members or properties of a class? Are your classes singleton or instanciated? You should give us an explicit (and if possible, simple) code example. V. ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/blackberry _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: problem to call a variable/widget in other fileHello Martin,
I have to admit that I don't get your problem completely. Do you have separate classes in each files? Do you try to access static parts of the classes? If you do have classes, did you create an instance of, for example, the login class? Best wishes, Martin Am 07.07.2009 um 07:55 schrieb Martin_GER: > > Has nobody a similar problem? Or is my inquiry not to understand? > > Or are your programs, always in a single .js-file? > > I need help...please ;-) > > > Thanks, > Martin > -- > View this message in context: http://n2.nabble.com/problem-to-call-a-variable-widget-in-other-file-tp3212530p3216475.html > Sent from the qooxdoo mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > Enter the BlackBerry Developer Challenge > This is your chance to win up to $100,000 in prizes! For a limited > time, > vendors submitting new applications to BlackBerry App World(TM) will > have > the opportunity to enter the BlackBerry Developer Challenge. See > full prize > details at: http://p.sf.net/sfu/blackberry > _______________________________________________ > qooxdoo-devel mailing list > qooxdoo-devel@... > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/blackberry _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: problem to call a variable/widget in other fileHi Martin,
just two hints, since I also don't understand your problem: - Have you regenerated your source (with "generate.py source")? - Have you read the documentation about classes? Maybe you could find a solution there: http://qooxdoo.org/documentation/0.8/classes Best, Michael ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/blackberry _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: problem to call a variable/widget in other fileHello, I have made a small complete program to show my problem. In "Desktop.js" I unique create the widgets (when clicking buttons) and store it in variable. By the next click on a button I hide the current widget and show needed widget! Thats my problem: - When the handy-widget is active -> how can I access to the telephone-textfield by clicking on the handy-button - When the handy-widget is active -> how can I complete change in the telephone-widget (like about the menu bar in "Desktop.js" Important: The widgets "handy and telephone" are loaded only once, so all changes will be keep -> also not create new widgets! Here the code: testprogramm/Application.js -> start of program /* ************************************************************************ #asset(testprogram/*) ************************************************************************ */ qx.Class.define("testprogram.Application", { extend : qx.application.Standalone, members : { main : function() { // Call super class this.base(arguments); this.programm = new testprogram.Desktop; this.getRoot().add(this.programm, {edge: 0}); } } }); testprogramm/Desktop.js -> here you will see the root desktop and a menubar. /* ************************************************************************ #asset(testprogram/*) ************************************************************************ */ qx.Class.define("testprogram.Desktop", { extend : qx.ui.container.Composite, construct : function() { this.base(arguments); this.widget = new Array(); this.variablen = new Array(); var haupt_layout = new qx.ui.layout.VBox(); haupt_layout.setSeparator("separator-vertical"); this.setLayout(haupt_layout); this.setBackgroundColor("#ffffff"); this.widget["main_container"] = this.create_main_container(); this.add(this.widget["main_container"], {flex : 1}); }, members : { widget : null, variablen : null, create_main_container : function() { //############################################ //hier: Programm-Container mit Menue erstellen //############################################ var layout = new qx.ui.layout.VBox(); var borderColor = "#cccccc"; var border_mainContainer = new qx.ui.decoration.Single(1, "solid", borderColor).set({ }); var mainContainer = new qx.ui.container.Composite(layout).set({ backgroundColor: "#cccccc", decorator: border_mainContainer }); mainContainer.add(this.create_Header()); mainContainer.add(this.create_Menubar()); this.widget["desktop"] = this.create_Desktop(); mainContainer.add(this.widget["desktop"], { flex: 1 }); return mainContainer; }, create_Header : function() { var layout = new qx.ui.layout.HBox(); var borderColor = "#cccccc"; var border = new qx.ui.decoration.Single(0, "solid", borderColor).set({ widthTop: 1, widthLeft: 1, widthRight: 1, widthBottom: 1 }); var headerContainer = new qx.ui.container.Composite(layout).set({ backgroundColor: "#ffffff", paddingTop: 8, paddingBottom: 8, paddingLeft: 8, paddingRight: 20, decorator: border }); headerContainer.setAppearance("app-header"); var title = new qx.ui.basic.Label("program titel"); var version = new qx.ui.basic.Label("version XXXX"); version.setTextColor("#0C2C66"); headerContainer.add(title); headerContainer.add(new qx.ui.core.Spacer, { flex : 1 }); headerContainer.add(version); return headerContainer; }, create_Menubar : function() { //################## //hier: Menue-Leiste //################## var toolbar = new qx.ui.toolbar.ToolBar(); var basic1Part = new qx.ui.toolbar.Part; toolbar.add(basic1Part); toolbar.addSpacer(); var basic2Part = new qx.ui.toolbar.Part; toolbar.add(basic2Part); var newButton1 = new qx.ui.toolbar.Button("home", ""); var newButton2 = new qx.ui.toolbar.Button("telephone", ""); newButton2.addListener("execute", function(e) { this.widget["desktop"].remove(this.widget["current_widget"]); if (!this.widget["telephone"]) { this.widget["telephone"] = new testprogram.telephone.Telephone(); this.widget["current_widget"] = this.widget["telephone"]; this.widget["desktop"].add(this.widget["current_widget"], {edge:0}); } else { this.widget["current_widget"] = this.widget["telephone"]; this.widget["desktop"].add(this.widget["current_widget"], {edge:0}); } }, this); var newButton3 = new qx.ui.toolbar.Button("handy", ""); newButton3.addListener("execute", function(e) { this.widget["desktop"].remove(this.widget["current_widget"]); if (!this.widget["handy"]) { this.widget["handy"] = new testprogram.handy.Handy(); this.widget["current_widget"] = this.widget["handy"]; this.widget["desktop"].add(this.widget["current_widget"], {edge:0}); } else { this.widget["current_widget"] = this.widget["handy"]; this.widget["desktop"].add(this.widget["current_widget"], {edge:0}); } }, this); var newButton4 = new qx.ui.toolbar.Button("config", ""); var newButton5 = new qx.ui.toolbar.Button("help", ""); var newButton6 = new qx.ui.toolbar.Button("logoff", ""); basic1Part.add(newButton1); basic1Part.add(newButton2); basic1Part.add(newButton3); basic1Part.add(newButton4); basic1Part.add(newButton5); basic2Part.add(newButton6); return toolbar; }, create_Desktop : function() { var windowManager = new qx.ui.window.Manager(); var borderColor = "#cccccc"; var border = new qx.ui.decoration.Single(1, "solid", borderColor); var desktop = new qx.ui.window.Desktop(windowManager).set({ backgroundColor: "#ffffff", decorator: border }); return desktop; } } }); testprogramm/handy/Handy.js -> here you will see a textfield + button. qx.Class.define("testprogram.handy.Handy", { extend : qx.ui.container.Composite, construct : function() { this.base(arguments); this.widget = new Array(); var haupt_layout = new qx.ui.layout.VBox(); haupt_layout.setSeparator("separator-vertical"); this.setLayout(haupt_layout); this.widget["desktop_handy"] = this.create_Desktop(); this.add(this.widget["desktop_handy"], {flex: 1}); this.widget["desktop_handy"].add(this.create_textfield()); this.widget["desktop_handy"].add(this.create_button()); }, members : { widget : null, create_Desktop : function() { var desktop = new qx.ui.container.Composite(new qx.ui.layout.HBox()).set({ backgroundColor: "red" }); return desktop; }, create_textfield : function() { var textfield = new qx.ui.form.TextField(); this.widget["handy_textfield"] = textfield; return textfield; }, create_button : function() { var button = new qx.ui.form.Button("action to telephone-widget"); button.addListener("execute", function(e) { alert("action to telephone-widget"); }, this); this.widget["handy_button"] = button; return button; } } }); testprogramm/telephone/Telephone.js -> here you will see a textfield + button. qx.Class.define("testprogram.telephone.Telephone", { extend : qx.ui.container.Composite, construct : function() { this.base(arguments); this.widget = new Array(); var haupt_layout = new qx.ui.layout.VBox(); haupt_layout.setSeparator("separator-vertical"); this.setLayout(haupt_layout); this.widget["desktop_telephone"] = this.create_Desktop(); this.add(this.widget["desktop_telephone"], {flex: 1}); this.widget["desktop_telephone"].add(this.create_textfield()); this.widget["desktop_telephone"].add(this.create_button()); }, members : { widget : null, create_Desktop : function() { var desktop = new qx.ui.container.Composite(new qx.ui.layout.HBox()).set({ backgroundColor: "blue" }); return desktop; }, create_textfield : function() { var textfield = new qx.ui.form.TextField(); this.widget["telephone_textfield"] = textfield; return textfield; }, create_button : function() { var button = new qx.ui.form.Button("action to handy-widget"); button.addListener("execute", function(e) { alert("action to handy-widget"); }, this); this.widget["telephone_button"] = button; return button; } } }); -- View this message in context: http://n2.nabble.com/problem-to-call-a-variable-widget-in-other-file-tp3212530p3230587.html Sent from the qooxdoo mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: problem to call a variable/widget in other fileHello Martin,
I have your example up an running but still don't get the problem really. Is it that you try to get the text of the textfield in the alert box? If yes, you need to have a reference to the Desktop object in both, the handy and the telephone object. You can manage that by handing a reference over on create time. this.widget["handy"] = new testprogramm.handy.Handy(this); Of course, you need so save that reference in the constructor of your handy class. construct : function(desktop) { this.base(arguments); this.__desktop = desktop; // two underscores indicate private variables .... } Now that you have the reference to the desktop, you can access the public stuff of it easily. button.addListener("execute", function(e) { var value = this .__desktop.widget["telephone"].widget["telephone_textfield"].getValue(); alert("action to telephone-widget"); }, this); Does that solve your problem? Best, Martin Am 09.07.2009 um 12:06 schrieb Martin_GER: > > Hello, > > I have made a small complete program to show my problem. > > In "Desktop.js" I unique create the widgets (when clicking buttons) > and > store it in variable. > By the next click on a button I hide the current widget and show > needed > widget! > > Thats my problem: > - When the handy-widget is active -> how can I access to the > telephone-textfield by clicking on the handy-button > - When the handy-widget is active -> how can I complete change in the > telephone-widget (like about the menu bar in "Desktop.js" > Important: The widgets "handy and telephone" are loaded only once, > so all > changes will be keep -> also not create new widgets! > > Here the code: > > testprogramm/Application.js -> start of program > /* > ************************************************************************ > #asset(testprogram/*) > ************************************************************************ */ > qx.Class.define("testprogram.Application", > { > extend : qx.application.Standalone, > > members : > { > main : function() > { > // Call super class > this.base(arguments); > > this.programm = new testprogram.Desktop; > this.getRoot().add(this.programm, {edge: 0}); > } > } > }); > > testprogramm/Desktop.js -> here you will see the root desktop and a > menubar. > /* > ************************************************************************ > #asset(testprogram/*) > ************************************************************************ */ > qx.Class.define("testprogram.Desktop", > { > extend : qx.ui.container.Composite, > construct : function() > { > this.base(arguments); > > this.widget = new Array(); > this.variablen = new Array(); > > var haupt_layout = new qx.ui.layout.VBox(); > haupt_layout.setSeparator("separator-vertical"); > this.setLayout(haupt_layout); > this.setBackgroundColor("#ffffff"); > > this.widget["main_container"] = this.create_main_container(); > this.add(this.widget["main_container"], {flex : 1}); > }, > members : > { > widget : null, > variablen : null, > create_main_container : function() > { > //############################################ > //hier: Programm-Container mit Menue erstellen > //############################################ > var layout = new qx.ui.layout.VBox(); > var borderColor = "#cccccc"; > var border_mainContainer = new qx.ui.decoration.Single(1, "solid", > borderColor).set({ }); > var mainContainer = new qx.ui.container.Composite(layout).set({ > backgroundColor: "#cccccc", > decorator: border_mainContainer > }); > > mainContainer.add(this.create_Header()); > mainContainer.add(this.create_Menubar()); > this.widget["desktop"] = this.create_Desktop(); > mainContainer.add(this.widget["desktop"], { flex: 1 }); > > return mainContainer; > }, > create_Header : function() > { > var layout = new qx.ui.layout.HBox(); > var borderColor = "#cccccc"; > var border = new qx.ui.decoration.Single(0, "solid", > borderColor).set({ > widthTop: 1, > widthLeft: 1, > widthRight: 1, > widthBottom: 1 > }); > > var headerContainer = new qx.ui.container.Composite(layout).set({ > backgroundColor: "#ffffff", > paddingTop: 8, > paddingBottom: 8, > paddingLeft: 8, > paddingRight: 20, > decorator: border > }); > headerContainer.setAppearance("app-header"); > > var title = new qx.ui.basic.Label("program titel"); > var version = new qx.ui.basic.Label("version XXXX"); > version.setTextColor("#0C2C66"); > headerContainer.add(title); > headerContainer.add(new qx.ui.core.Spacer, { flex : 1 }); > headerContainer.add(version); > > return headerContainer; > }, > create_Menubar : function() > { > //################## > //hier: Menue-Leiste > //################## > var toolbar = new qx.ui.toolbar.ToolBar(); > > var basic1Part = new qx.ui.toolbar.Part; > > toolbar.add(basic1Part); > > toolbar.addSpacer(); > > var basic2Part = new qx.ui.toolbar.Part; > toolbar.add(basic2Part); > > var newButton1 = new qx.ui.toolbar.Button("home", ""); > > var newButton2 = new qx.ui.toolbar.Button("telephone", ""); > newButton2.addListener("execute", function(e) { > this.widget["desktop"].remove(this.widget["current_widget"]); > if (!this.widget["telephone"]) > { > this.widget["telephone"] = new testprogram.telephone.Telephone(); > this.widget["current_widget"] = this.widget["telephone"]; > this.widget["desktop"].add(this.widget["current_widget"], {edge: > 0}); > } > else > { > this.widget["current_widget"] = this.widget["telephone"]; > this.widget["desktop"].add(this.widget["current_widget"], {edge: > 0}); > } > }, this); > > var newButton3 = new qx.ui.toolbar.Button("handy", ""); > newButton3.addListener("execute", function(e) { > this.widget["desktop"].remove(this.widget["current_widget"]); > if (!this.widget["handy"]) > { > this.widget["handy"] = new testprogram.handy.Handy(); > this.widget["current_widget"] = this.widget["handy"]; > this.widget["desktop"].add(this.widget["current_widget"], {edge: > 0}); > } > else > { > this.widget["current_widget"] = this.widget["handy"]; > this.widget["desktop"].add(this.widget["current_widget"], {edge: > 0}); > } > }, this); > > var newButton4 = new qx.ui.toolbar.Button("config", ""); > var newButton5 = new qx.ui.toolbar.Button("help", ""); > var newButton6 = new qx.ui.toolbar.Button("logoff", ""); > > basic1Part.add(newButton1); > basic1Part.add(newButton2); > basic1Part.add(newButton3); > basic1Part.add(newButton4); > basic1Part.add(newButton5); > basic2Part.add(newButton6); > > return toolbar; > }, > create_Desktop : function() > { > var windowManager = new qx.ui.window.Manager(); > var borderColor = "#cccccc"; > var border = new qx.ui.decoration.Single(1, "solid", > borderColor); > var desktop = new qx.ui.window.Desktop(windowManager).set({ > backgroundColor: "#ffffff", > decorator: border > }); > > return desktop; > } > } > }); > > testprogramm/handy/Handy.js -> here you will see a textfield + button. > qx.Class.define("testprogram.handy.Handy", > { > extend : qx.ui.container.Composite, > > construct : function() > { > this.base(arguments); > > this.widget = new Array(); > > var haupt_layout = new qx.ui.layout.VBox(); > haupt_layout.setSeparator("separator-vertical"); > this.setLayout(haupt_layout); > > this.widget["desktop_handy"] = this.create_Desktop(); > > this.add(this.widget["desktop_handy"], {flex: 1}); > > this.widget["desktop_handy"].add(this.create_textfield()); > this.widget["desktop_handy"].add(this.create_button()); > }, > members : > { > widget : null, > create_Desktop : function() > { > var desktop = new qx.ui.container.Composite(new > qx.ui.layout.HBox()).set({ > backgroundColor: "red" > }); > > return desktop; > }, > create_textfield : function() > { > var textfield = new qx.ui.form.TextField(); > > this.widget["handy_textfield"] = textfield; > > return textfield; > }, > create_button : function() > { > var button = new qx.ui.form.Button("action to telephone-widget"); > button.addListener("execute", function(e) { > alert("action to telephone-widget"); > }, this); > > this.widget["handy_button"] = button; > > return button; > } > } > }); > > > testprogramm/telephone/Telephone.js -> here you will see a textfield + > button. > qx.Class.define("testprogram.telephone.Telephone", > { > extend : qx.ui.container.Composite, > > construct : function() > { > this.base(arguments); > > this.widget = new Array(); > > var haupt_layout = new qx.ui.layout.VBox(); > haupt_layout.setSeparator("separator-vertical"); > this.setLayout(haupt_layout); > > this.widget["desktop_telephone"] = this.create_Desktop(); > > this.add(this.widget["desktop_telephone"], {flex: 1}); > > this.widget["desktop_telephone"].add(this.create_textfield()); > this.widget["desktop_telephone"].add(this.create_button()); > }, > members : > { > widget : null, > create_Desktop : function() > { > var desktop = new qx.ui.container.Composite(new > qx.ui.layout.HBox()).set({ > backgroundColor: "blue" > }); > > return desktop; > }, > create_textfield : function() > { > var textfield = new qx.ui.form.TextField(); > > this.widget["telephone_textfield"] = textfield; > > return textfield; > }, > create_button : function() > { > var button = new qx.ui.form.Button("action to handy-widget"); > button.addListener("execute", function(e) { > alert("action to handy-widget"); > }, this); > > this.widget["telephone_button"] = button; > > return button; > } > } > }); > > > > -- > View this message in context: http://n2.nabble.com/problem-to-call-a-variable-widget-in-other-file-tp3212530p3230587.html > Sent from the qooxdoo mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > Enter the BlackBerry Developer Challenge > This is your chance to win up to $100,000 in prizes! For a limited > time, > vendors submitting new applications to BlackBerry App World(TM) will > have > the opportunity to enter the BlackBerry Developer Challenge. See > full prize > details at: http://p.sf.net/sfu/Challenge > _______________________________________________ > qooxdoo-devel mailing list > qooxdoo-devel@... > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: problem to call a variable/widget in other fileFinally, the problem is solved. Now I have full access to the desktop.js and telephone.js! Thanks. :jumping: Martin -- View this message in context: http://n2.nabble.com/problem-to-call-a-variable-widget-in-other-file-tp3212530p3232332.html Sent from the qooxdoo mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
| Free embeddable forum powered by Nabble | Forum Help |