I usually set the button context to the handler function, instead of "this"
If you need the "this" context within the event handler, you can set a "self" 
user data

     this.buttons[row].setUserData("SHOPID",j["data"][row]["SHOPID"]);
     this.buttons[row].setUserData("self", this);
     this.buttons[row].addListener("click", function(e) {
          var self = this.getUserData("self")
          var shopId = this.getUserData("SHOPID")
          self.buttons[42].setValue(false);  // <--- some example using self
     }, this.buttons[row]);


Von: [email protected] [mailto:[email protected]]
Gesendet: Dienstag, 15. März 2011 17:22
An: qooxdoo Development
Betreff: [qooxdoo-devel] dynamic event object?

i want to create some tooglebuttons inside a list. everything works fine, but 
how can i make an event, that deselect all other tooglebuttons without the 
clicked?

i try this

                    var j = e.getContent(); // Result ajax request
                    for (row = 0;row < j["data"].length;row++) {
                        this.buttons[row] = new 
qx.ui.form.ToggleButton(j["data"][row]["title"]).set({
                            toolTipText : j["data"][row]["title"]
                            });
                        
this.buttons[row].setUserData("SHOPID",j["data"][row]["SHOPID"]);

                        this.buttons[row].addListener("click", function(e) {

                            //alert(this.buttons[row].getUserData("SHOPID"));
                            },this);

                        shoplist.add(this.buttons[row]);
                        if (row == 0 ) {
                            shoplist.getChildren()[row].setValue(true);
                            }
                        }


my problem is the listener. when i tryto access the  clicked button via the 
array, he dont know the row number, when i add the buttons instead  this and 
access inside  the listener via this, it worksbut i cant access the list/other 
buttons. Or is their a  option to access the parent object of an  tooglebutton 
object?
or some other idea?


thank you

----------------------------------------------------------------------


interpack – Processes and Packaging 2011
From May 12 - 18, 2011, we will be pleased to welcome you to the interpack in 
Düsseldorf, Germany - we will present our innovations in hall 16, stand B23/D24.

----------------------------------------------------------------------


Uhlmann Pac-Systeme GmbH & Co. KG
Registergericht Ulm HRA 640435.
Persönlich haftende Gesellschafterin:
Uhlmann Pac-Systeme Verwaltungsgesellschaft mbH      
Registergericht Ulm HRB 640137

USt-IdNr. DE 144893484                                 

Vorsitzender des Aufsichtsrats:
Tobias Uhlmann
Geschäftsführer:
Norbert Gruber (Vorsitzender)
Hans-Werner Bongers
Siegfried Drost
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to