PDA

View Full Version : tree and onkeyxxx events


lipe
11-11-2004, 03:05 AM
Hello, good monrning.

Is there a way to implements onkeyxxx events on trees?

I tried this:


<class name="treeLink" extends="tree">
<method event="onkeypress">
Debug.write( 'onkeypress' );
</method>
</class>

// my tree


But it doesn´t work at all. It would be nice if the user could fire my other actions from the keyboard.

Thanks!

pablo
11-11-2004, 09:39 AM
Hi,

The reason tree isn't getting the keyboard event is because its implementation has its "item" receiving those events. Try this:


<canvas debug="true">

<include href="lz/tree.lzx"/>

<class name="treeLink" extends="tree">
<method event="onkeydown" reference="item">
Debug.write( 'keydown' );
</method>
<method event="onkeyup" reference="item">
Debug.write( 'keyup' );
</method>
</class>

<treeLink text="top">
<treeLink text="one" />
<treeLink text="two" />
</treeLink>

</canvas>


I'll file a todo item to add keyboard events on the tree itself. Hope this helps!

pablo

lipe
11-11-2004, 06:56 PM
Thanks a lot!

I had this same problem width js + xul, and the solution wasn´t even near as elegant as this :D