Hi Phillipe, Philippe Poulard wrote: > hi, > > I have a tree and instead of setting labels on folders, I add widgets, > actually a stack with 2 items: > -a label > -a text field > > When the label is clicked, the stack is moved to the text field to allow > the user to edit it > > Unfortunately, the "left" and "right" keys are catched by the parent > tree that open/close the folder to which the stack belong, instead of > moving the caret left and right > > -How to disabled temporarily those keys on this folder item ? If the caret is inside the textfield you can add a keypress listener to this widget and stop the propagation of the event to prevent that the folder widget is getting this event.
--snip-- textField.addListener("keypress", function(e){ switch(e.getKeyIdentifier()) { case "left": case "right": e.stopPropagation(); break; } }, textField); --snip-- Hint: this is just example code. Avoid inline functions. See http://qooxdoo.org/documentation/0.8/antipatterns#inline_functions for details. > -How to catch the ESC key to cancel the edition (by moving the stack > back to the label) ? Just add a "case" statement for "Escape" and execute "e.stop()". This will stop the event propagation itself and will prevent the default behaviour of the browser. > -If I register a keypress event, and I don't get a "left" or "right or > "ESC", how can I propagate it ? You can use the "keyIdentifier" as in the example above to work with the keyEvents. > -If I can catch "left" or "right" key, how to go left or right on the > text field (if I can't disable those keys on the folder item) ? The answer is to let the event pass and only stop the propagation of the event. This way only the textfield widget works with the event and all other widgets are not notified and do not react on the key event. Hope this helps, Alex ------------------------------------------------------------------------- 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 qooxdoo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel