Addin Combo Box

Discussion created by F_Kellner on Nov 5, 2013
Latest reply on Jun 13, 2014 by johnmdye
I have been struggling to get the combo box addin working properly on toolbars that I have created. So in attempt to better understand the combo box I have been trying to implement a combo box using the example from the documentation.

The documentation states "this topic examines the process of creating a combo box with the list of layers from the table of contents. Selecting a layer will create a fishnet covering the full extent of the layer".

And I have used the code example in the documentation

# Business logic to implement the ComboBox
def __init__(self):
        self.editable = True
        self.enabled = True

def onSelChange(self, selection):

 # When a new layer is selected, create a new fishnet using the extent of layer.
 layer = arcpy.mapping.ListLayers(self.mxd, selection)[0]
 desc = arcpy.Describe(layer.dataSource)
 extent = desc.Extent
 fishnet = arcpy.CreateFishnet_management(r'in_memory\fishnet',
                 '%f %f' %(extent.XMin, extent.YMin),
                 '%f %f' %(extent.XMin, extent.YMax),
                 0, 0, 10, 10,
                 '%f %f' %(extent.XMax, extent.YMax),
                 '%f %f %f %f' %(extent.XMin, extent.YMin, extent.XMax, extent.YMax), 'POLYGON')

def onFocus(self, focused):

  # When the combo box has focus, update the combo box with the list of layer names.
 if focused:
  self.mxd = arcpy.mapping.MapDocument('current')
  layers = arcpy.mapping.ListLayers(self.mxd)
  self.items = []
  for layer in layers:

But I have been unable to get the toolbar to work. The toolbar shows up in arcmap but there is no drop down and I get the missing message on the toolbar itself.

Any suggestions?