tags:

views:

440

answers:

1

Easily reproducible in GWT 1.6.4:

Tree tree = new Tree();
tree.addItem(new TextBox());

The problem lies with onBrowserEvent in Tree:

switch (eventType) {
  case Event.ONKEYDOWN:
  case Event.ONKEYUP: {
    if (isArrowKey(DOM.eventGetKeyCode(event))) {
      DOM.eventCancelBubble(event, true);
      DOM.eventPreventDefault(event);
      return;
    }
  }

Like a lot of GWT widgets, they don't subclass well. There has to be a simple trick I could swing for this?

A: 

Solved this with a bit of a hack.

 m_tree = new Tree()
 {
  @Override
  protected boolean isKeyboardNavigationEnabled(TreeItem inCurrentItem)
  {
   return false;
  }

  @Override
  public void onBrowserEvent(Event event) {
   int eventType = DOM.eventGetType(event);

   switch (eventType)
   {
    case Event.ONKEYDOWN:
    case Event.ONKEYPRESS:
    case Event.ONKEYUP:
     return;
    default:
     break;
   }

   super.onBrowserEvent(event);
  }
 };
Hans Sjunnesson