:: Forum >>

Override onkeypress for UI.Tree

Does anyone have a way to override the onkeypress events for the AW.UI.Tree?
Rick Villela
Friday, April 14, 2006
You can attach an event handler to onKeyPress event or individual keys, like onKeyUp, onKeyDown etc. Full list is here -


You should also return non-zero rezult to cancel a default action defined in the tree selection controller.

In fact, the tree does not have its own selection and keyboard navigation controller - in 2.0 it simply inherits the one from the AW.UI.List control (that's why it does not work).

If you want to fix it - you should look at /source/lib/ui/_single.js (kb mapping) and /source/lib/ui/_actions.js (selection/navigation implementation) and adjust them for the tree.

On of the problem in the current tree - the parent node index is missing from the view (or item) model, so it should be added (and probably calculated from the view/indices and view/count or vice versa).
Alex (ActiveWidgets)
Monday, April 17, 2006
The link to the control-keyboard-events was extremley helpful!

I was able to workout the indicies issue for the up and down arrows, but was wondering if there was a method that indicates if an item is being displayed or not. I know I can tell if the parent is expanded and I can create another array that has the parents to the items, but I was hoping for something more straight forward.
Rick Villela
Tuesday, April 18, 2006

This topic is archived.

Back to support forum

Forum search