Hi, I try in GWT to create a Tree with multiple selection for the nodes and ran into a problem similar to this question http://stackoverflow.com/questions/1411752/shift-key-in-gwt. When a selectionEvent is raised from the Tree, I would like to know if the Shift key is pressed or not.
SelectionHandler<TreeItem> getSelectionHandler() {
return new SelectionHandler<TreeItem>(){
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
// is shift key pressed ?
}
};
}
The solution in the question above cannot apply in this case as the SelectionHandler class does not inherit from DOMEvent and then does not have a getNativeEvent() function.
I tried a dirty solution by adding keyDownEventHandler and keyUpEventHandler to the Tree with a boolean flag but the handlers are only called when the focus is on the tree so this doesn't work.
Is there a simple solution (or just a solution even if it's not simple) ? Thanks.
Edit on aem response : The solution can work by enclosing the components in a FocusPanel with a keyUp/DownHandler but then I can't add any component needing keyboard input such as TextArea as the "global" handler takes the priority... So it don't really solve my problem.