-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I'm trying to build a textbox where an user has the possibility to type some word or have some suggest when ctrl+s is pressed. Now the problem is this: when a user type chars or numbers, or delete some something, the position of text cursor is update, and I can insert the suggestion in the right position. But if the client press any arrows (UP, DOWN, ext), maybe to move to another word or at the last of a phrase, the position of text cursor isn't update and when i want to insert a suggest word, this word is insert in another point. So my question is, can i generate or capture a arrows event?
This is my code:
@Listen("onChanging=#sel") public void onChange(Event event) { if (event instanceof org.zkoss.zk.ui.event.InputEvent) { sc.setCaretPosition(((org.zkoss.zk.ui.event.InputEvent) event) .getStart()); } if (sc.getCtrlYes()) { if (popSel.getChildren().size() != 0) { popSel.close(); popSel.removeChild(popSel.getChildren().get(0)); } ListWord lw = new ListWord(sel, popSel); popSel.appendChild(lw); popSel.open(sel, "after_center"); } }
Asked: 2014-05-22 01:42:59 +0800
Seen: 8 times
Last updated: May 22 '14