开发者

focus & key board listner problem in cell table in gwt

开发者 https://www.devze.com 2023-01-27 15:42 出处:网络
I have one small problem i.e. one textbox is their when click on the 开发者_C百科text box the popup is shows below the text box.The popup containscelltable

I have one small problem i.e. one textbox is their when click on the 开发者_C百科text box the popup is shows below the text box.The popup contains celltable

i write keypresslisner for textbox when i press Down And UP arrow the focus is set to be cellTable And also we still press down and up arrows its highlites the rows in celltable

     anyone  please tell me how to solve it...it's my request

When I wrote code like this:

box.addKeyPressHandler(new KeyPressHandler() {

@Override public void onKeyPress(KeyPressEvent event) {

if (event.getNativeEvent().getKeyCode() == 38) {
 celltable.setFocus(true);
} else if (event.getNativeEvent().getKeyCode() == 40) {
 celltable.setFocus(true);
}

}

});

only the focus is goes to the cell table


The question is a little bit unclear, but I think you may be helped by FocusPanel:

http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/user/client/ui/FocusPanel.html

Wrap your CellTable in this FocusPanel and you can do setFocus() on that instead. The FocusPanel has addKeyPressHandler(), so you can capture further keypress events there, also when your textbox has lost the focus.

0

精彩评论

暂无评论...
验证码 换一张
取 消