I'm developing a Combo Box for an ArcMap toolbar, that at present simply lists all of the layers that are in the table of contents. However the height of the drop-down menu is very small, and I cannot see a property that I can set to change the default height of the drop-down list. I've attached a screenshot to demonstrate the problem. You can see that only one item is visible in the drop-down menu, although there are four layers in the TOC. The other layers can be accessed (look at the tiny arrow buttons, which do work), but it is really difficult to do.

enter image description here

In the add-in config.xml there is a rows property, which defaults to 4. Changing it to a higher or smaller number does nothing.

In the Combo Box documentation, there are properties for the Python class controlling the Combo Box. These allow control of dropdownWidth and width, bizarrely controlled by supplying a string of lots of the same character.

I've been using the Python add-in wizard to form the template. I'd like to stick to that but I'm open to ArcObjects if that's the only solution.

1 Answer 1


There is no property that defines the number of items that can be shown in the ComboBox. Instead, use the onFocus method to append the layers in the TOC to the drop-down list.

def onFocus(self, focused):
        # When focused, 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:

If you don't want to add all the layers, you can limit this by processing the list choosing what kind of layers you want to keep. This filter can be set based on the name, shape type, or data source. enter image description here

  • Ahh, I see. I was just populating self.items with the layer objects, rather than the name attribute of the layer objects, and then in my __init__ method setting self.value = self.items[0].name. Thanks. Apr 8, 2015 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.