ionarawilson

If editable is False, the user cannot select anything on the combobx python add-in

Discussion created by ionarawilson on Oct 30, 2013
Latest reply on Oct 30, 2013 by ionarawilson
I have two comboboxes created with the python addin. The second combobox items are filtered by the selections on the first. I want them not to be able to type anything on the combobxes, but when I set the editable property to false, it does not let the user select anything, not even the items I defined for that combobox. This contradicts the documentation that says the editable property, the user can  choose from the options provided in the combo box. Do  you guys have any idea why this is happening and how I can change it?  Thank you!

import arcpy
import pythonaddins

class ComboBoxClass1(object):
    """Implementation for Comboboxes_addin.combobox (ComboBox)"""
    def __init__(self):
        self.items = ["Forestry", "OW", "Urban", "Fire", "ED/PR", "PD", "Media"]
        self.editable = False
        self.enabled = True
        self.dropdownWidth = 'WWWWWW'
        self.width = 'WWWWWW'
    def onSelChange(self, selection):
      if selection == "Forestry":

                combobox_1.items = ["SP", "SPR", "MP", "AR", "ARO", "ATF", "ATN", "ACF", "TT", "RC", "RV", "AIR", "AP", "FHS", "FSU", "BMP"]
                combobox_1.value = combobox_1.items[0]
      elif selection == "OW":

                 combobox_1.items = ["AOS", "AO", "AIO", "PO", "TGO", "TRO"]
                 combobox_1.value = combobox_1.items[0]

    def onEditChange(self, text):
        itemsarray = ["Forestry", "OW", "Urban", "Fire", "ED/PR", "PD", "Media"]
        if text not in itemsarray:

            combobox_1.items = [" ", " ", "", " ", "", "", "", "", "", "", "", "", "", "", "", ""]
    def onFocus(self, focused):
        pass
    def onEnter(self):
        pass
    def refresh(self):
        pass

class ComboBoxClass2(object):
    """Implementation for Comboboxes_addin.combobox_1 (ComboBox)"""
    def __init__(self):
        self.items = [" ", " ", "", " ", "", "", "", "", "", "", "", "", "", "", "", ""]
        self.editable = True
        self.enabled = True
        self.dropdownWidth = 'WWWWWW'
        self.width = 'WWWWWW'
        self.refresh()
    def onSelChange(self, selection):
        self.refresh()
    def onEditChange(self, text):
        pass
    def onFocus(self, focused):
         self.refresh()
    def onEnter(self):
        pass
    def refresh(self):
        pass

Outcomes