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
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to