0

My ArcMap (10.5.1) Python add-in uses a combobox. When an item is selected from the combobox's drop-down menu, the expected actions are executed successfully. Sometimes these actions actions can take some time to complete, and sometimes some further UI is required (in the simplest case, a progress dialogue). The problem is that the combobox's drop-down menu remains visible on screen during this time and can partially or completely obscure whatever subsequent UI is displayed.

I would like the combobox to be dismissed as soon as I make the selection (eg, at the beginning of onSelChange()).

How can I force the combobox's drop-down menu to disappear immediately after an item has been selected?

The combobox will disappear as soon as I interact with anything else on screen (outside of the combobox). But this is not really sufficient and results in a terrible UI.

Below is the minimal add-in code that demonstrates the issue for a combo-box:

import arcpy, pythonaddins, time

class TestComboBox(object):
    """Implementation for TITest_addin.TestComboBox (ComboBox)"""
    def __init__(self):
        self.items = ["Item {}".format(i) for i in range(100)]
        self.editable = False
        self.enabled = True
        self.dropdownWidth = 30 * 'W'
        self.width = 10 * 'W'
    def onSelChange(self, selection):
        with pythonaddins.ProgressDialog() as prog:
                prog.title = "This is a test."
                prog.animation = "Spiral"
                prog.canCancel = False
                time.sleep(10)
    def onEditChange(self, text):
        pass
    def onFocus(self, focused):
        pass
    def onEnter(self):
        pass
    def refresh(self):
        pass

UPDATE:

I think that any combobox add-in with self.editable = False may exhibit the same problem. Merely changing that line to self.editable = True fixes the issue. However, having self.editable = True is not an option for my add-in.

I have logged this issue with ESRI now, and will post back here if I get any useful information from them.

  • 1
    Sounds like you need to force some sort of application refresh on the GUI, I don't believe arcpy exposes such methods, happy to be proven wrong! – Hornbydd Aug 8 '18 at 16:40
0

Following my support request, ESRI have now logged this as a bug. It's not yet clear if/when it will be fixed, but they are investigating further.

ESRI also noted that the drop-down blocks not only other add-in UI elements, but anything else on the entire computer. They particularly noted that if they switch to their browser, even the view of the browser is blocked by the add-in's drop-down.

ESRI Bug is at: https://my.esri.com/#/support/bugs/BUG-000117373

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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