On Wed, Aug 6, 2008 at 2:49 PM, Guilherme Aiolfi <[EMAIL PROTECTED]> wrote:
> Hi List,
>
> I'm trying to get the TreeFolder that was double clicked:
>
> var node = new qx.ui.tree.TreeFolder ("first");
> node.setUserData({a: 'b', c: 'd'});
> treeView.getRoot().add(node);
> node.addListener("dblclick", this._onTreeDblClick);
>
> ...
> _onTreeDblClick: function(e)
> {
> console.log (this.getUserData());
> }
>
> It is not working. Actually I would like to add a "dblclick" event listener
> in the tree, like so:
>
> treeView.addListener("dblclick", this._onTreeDblClick, this); // just to
> keep all "this" references to the instance
>
> but I'm a little lost with e.getTarget(), e.getRelatedTarget(),
> e.getOriginalTarget(), e.getCurrentTarget().
>
> How to get that "user data" on "dblclick" event?
I would just define a function anonymously within the addListener
call, then it has access to all those variables in the scope. This is
probably my favorite thing about event programming in JavaScript vs.
C++. Granted, if you look at the email I sent you can see that it can
get a little out of hand when you start nesting the event handlers. It
would probably work if you defined the function within the calling
function, JavaScript scoping is funky like that.
Ian
-------------------------------------------------------------------------
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