开发者

Is it possible to expand GWT droplist(ListBox) by keyboard?

I have a flextable full of listboxes set to listBox.setVisibleItemCount(1), so they act as droplists. When clicked on with the left mouse button they expand and let the user select an item. Is it possible to mimic the mouse click with a key开发者_StackOverflow社区board key?

I've already tried to add keypress handler to the listbox that will fire a mousedown native event, but that did nothing.

Anyone have any idead?

Thanks in advance


I haven't found a solution yet for my problem but I have this workaround that works for now:

    listBox.addBlurHandler(new BlurHandler() {
        public void onBlur(BlurEvent event) {
            ListBox listBox = ((ListBox)event.getSource());
            SelectElement.as(listBox.getElement()).setSize(1);
        }
    });

    listBox.addKeyPressHandler(new KeyPressHandler() {
        public void onKeyPress(KeyPressEvent event ) {              
            if (event.getCharCode() == 32) {
                ListBox listBox = ((ListBox)event.getSource());
                SelectElement.as(listBox.getElement()).setSize(listBox.getItemCount());                 
            }
        }
    });
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜