Hello Nick!

Please note that the scope inside event handlers is different so that 
"this" is linked to window object. To set a scope (and change the "this" 
reference to an object you want) addListener() takes a third argument:

http://demo.qooxdoo.org/current/apiviewer/#qx.core.Object~addListener

In short: just change

ClickMeButton.addListener("click",menuAction);

to

ClickMeButton.addListener("click",menuAction, this);


Kind regards,
Jonathan


nislim wrote:
> Thanks for the reply but now I have another problem:
> 
> This works:
> 
>   var menuAction = function(e) { alert("You clicked me!"); };
>   var ClickMeButton= new qx.ui.menu.Button("Click me",null,
> this.debugButton);
>   ClickMeButton.addListener("click",menuAction);
> 
> But
> 
>  var menuAction = function(e) { this.CreateMenu(); };
>  var ClickMeButton= new qx.ui.menu.Button("Click me",null,
> this.debugButton);
>  ClickMeButton.addListener("click",menuAction);
> 
> CreateMenu : function()
> {
> alert("You clicked me!"); 
> },
> 
> The function works if I just add it to the main funtion.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to