class ComboBoxClass4(object): """Implementation for MTR_addin.combobox (ComboBox)""" def __init__(self): self.value = "S" self.items = ("C", "F", "K", "S", "U") self.editable = True self.enabled = True self.dropdownWidth = 'WWW' self.width = 'WWW' def onSelChange(self, selection): pass def onEditChange(self, text): pass def onFocus(self, focused): pass def onEnter(self): pass def refresh(self): pass
Solved! Go to Solution.
And remember when you access your combobox you need to first have assign it properties through the class level self variables. You might be missing this part in your combobox class.def onSelChange(self, selection): self.sel = selection
Then get the selection in your other classes like this.combobox.sel
Twp = [] for row in arcpy.SearchCursor("X:\JasonGraham\Landstatus\Data\ls2014.gdb\BaseData\Townships"): Twp.append(row.TWP_NUMC) class ComboBoxClass5(object): #Collect Township from list of unique values gathered from the layer """Implementation for MTR_addin.combobox_1 (ComboBox)""" def __init__(self): self.value = "000" self.items = sorted(Twp) self.editable = True self.enabled = True self.dropdownWidth = 'WWWW' self.width = 'WWWW' def onSelChange(self, selection): self.sel = selection #global valName #val = (self.items, selection)[1] #valName = str(val) def onEditChange(self, text): pass def onFocus(self, focused):#show only unique values if focused: values = sorted(Twp) uniqueValues = set(values) self.items = [] for uniqueValue in uniqueValues: self.items.append(uniqueValue) def onEnter(self): pass def refresh(self): pass