Search code examples
eclipsecomboboxadd-inarcgis

how do you make the ArcGIS combobox editable?


I'm trying to make ESRI's ArcGIS combobox editable. I'm using eclipse and writing in java to create an addin. I can get onEditChange() to work no problem. The only trouble is, after checking the editable checkbox in the config xml, the combobox updates with every keystroke.

For example, an entry of blah would be entered into the combobox as:

b bl bla blah

not most useful.

I've tried using the onEnter() method but this just doesn't appear to work. If anyone has used the combobox before for something similar please let me know.

I'll update if I crack it.


Solution

  • Done it. I was missing the wood for the trees. Here's the code:

    String text;
    
    public void onEditChange(String editString) {
        text = editString;
    }
    
    public void onEnter() {
        add(text);
    }
    

    simples.

    It seems the default cookie given to a new entry is 35500. Each new edit increments by 1. If anyone gets a different default on a new entry please let know. Cookies are important for getSelected() etc.