I had a tyoe, it should have been:

this.createObjectWindow

and Button will always be an object, it just doesn't always have the
variable name 'Button'. You can always assign an event handler to an object
created the way you are creating the Buttons, qooxdoo keeps track of the
object reference and knows how to handle it. In your code, I don't know what
'this' is referring to, what object are you referencing with it? And you
can't use getValue on the button if you haven't assigned a value to it, you
can access it's label.

I see another change you can make to the sample I sent, try this:

for (var in list){
  var Button = new qx.ui.menu.Button(list[var], null, this.debugButton);

  Button.addListener("click", function() {
   {need to directly reference your other object
here}.createObjectWindow(this.getLabel())
  }, Button)

  menuBar.add(Button);
}

Jim


On Thu, Jan 1, 2009 at 12:23 PM, nislim <aerts.n...@gmail.com> wrote:

>
> Also your solution doesn't work, it's gives me this: function () { return
> qx.core.Property.executeOptimizedGetter(this, clazz, name, "get");}, also
> if
> i use getValue it doesn't work because the Button isn't defined anymore
> when
> you try to use the event.
>
>
> Jim Hunter-2 wrote:
> >
> > You don't need to get the hash name, in the same block of code where you
> > are
> > creating the button, assign the listener there and also add it to the
> > menuBar there as well. qooxdoo will keep track of the proper assignments.
> > So
> > change your code to be something like this:
> >
> > for (var in list){
> >   var Button = new qx.ui.menu.Button(list[var], null, this.debugButton);
> >
> >   Button.addListener("click", function() {
> >    Button.createObjectWindow(Button.getLabel())
> >   })
> >
> >   menuBar.add(Button);
> > }
> >
> > Hope this helps,
> > Jim
> >
> >
> >
> > On Wed, Dec 31, 2008 at 4:11 AM, nislim <aerts.n...@gmail.com> wrote:
> >
> >>
> >> I want to load buttons from an RPC-Backend, this goes fine. But i don't
> >> know
> >> how to retrieve the name or the value of the button. This is the code i
> >> use:
> >>
> >> for (var in list){
> >>   var Button = new qx.ui.menu.Button(list[var],null, this.debugButton);
> >>
> >>  var ButtonAction = function(e) {
> >>    this.createObjectWindow(ButtonName);
> >>  };
> >>
> >>  AppButton.addListener("click",AppAction, this);
> >>  menuBar.add(AppButton);
> >> }
> >>
> >> I cant get buttonname, i tried:
> >> 1. list[var] but that gave me the name of the last in the list.
> >> 2. e.getName but that didn't gave me the name of the button but the name
> >> of
> >> the Event.
> >> --
> >> View this message in context:
> >>
> http://n2.nabble.com/Button-event-handling-question-tp2095891p2095891.html
> >> Sent from the qooxdoo mailing list archive at Nabble.com.
> >>
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> _______________________________________________
> >> qooxdoo-devel mailing list
> >> qooxdoo-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> >>
> >
> >
> ------------------------------------------------------------------------------
> >
> > _______________________________________________
> > qooxdoo-devel mailing list
> > qooxdoo-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/Button-event-handling-question-tp2095891p2099651.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to