Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

register KeyDownHandler on VerticalPanel

 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
I have a gwt VerticalPanel class that i need to handel KeyDown events for it.
the method i used to implement keyboard handler in my class is:
i add :

to constructor
then i override method onBrowserEvent() to handle key down event.



however this method doesn’t work for this VerticalPanel class which extends a VerticalPanel.no KeyDown Event is fired when i press a key!

there are specific gwt widgets that support KeyDownHandler like Button etc..VerticalPanel is not one of them..so we need a work around to register a KeyDownHandler on a class extending VerticalPanel.
can you suggest an idea or hint?
thanks

thanks
 
Suhas Bilaye
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You need to implement the HasKeyDownHandlers interface in order to add the key down handler capability to your vertical panel.



 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suhas Bilaye wrote:Hi,

You need to implement the HasKeyDownHandlers interface in order to add the key down handler capability to your vertical panel.




yes I solved it by wrapping VerticalPanel inside a FocusPane. gwt Focuspanel support most events handlers including key events.
thanks for the reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic