Question

I am getting the key press of each word and I need to make an autosuggest in a combobox. My code is the following:

<zk>
    <window border="normal" apply="org.test.test" id="win" >
    <combobox id="combo" autodrop="true"/>
    </window>
</zk>


The GenericForwardComposer:

public class test extends GenericForwardComposer{
   Combobox combo; //ZK Auto Wired , use combo directly

   public void onChanging$combo() { // ZK Autoforward (Awesome !!)
     suggest();
   }

   public void suggest() {   
     System.out.println(combo.getText());
     combo.getItems().clear();
     combo.appendItem("Ace");
     combo.appendItem("Ajax");
     combo.appendItem("Apple");
     combo.appendItem("Best");
     combo.appendItem("Blog");
   }

 }

This is not printing the first key when I press a key. Can I please get some help to know why????

Was it helpful?

Solution

When onChanging is received, the value of combobox is not changed yet. You have to get the value from the event

public void onChanging$como(InputEvent event) {
    event.getValue(); //<- the value of combobox being entered so far
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top