AnsweredAssumed Answered

Two addin comboboxes - Second combobox is showing previous selection - not refreshing

Question asked by ionarawilson on Oct 29, 2013
Latest reply on Oct 30, 2013 by ionarawilson
I have two python addin comboboxes. The selection of the second combobox is based on the first. So I choose the an option in combobox1 (let's say I choose "Forestry"), it will give me a list of options such as SP, SPR, MP, etc. If I choose "OW", it will give me AOS, AO, AIO, etc. However the last selection is lingering there. So If choose Forestry and click on SP, then I choose OW, SP lingers there in the list with the other items for OW. How I can make that item from that selection disappears? Thanks


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 = True         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"]       elif selection == "OW":                   combobox_1.items = ["AOS", "AO", "AIO", "PO", "TGO", "TRO"]      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