wx.adv.OwnerDrawnComboBox and AUI

Dear wxPython Users,

Long time no see :slight_smile: .

I have noticed a very peculiar - and fantastically annoying - behavior of wx.adv.OwnerDrawnComboBox (and wx.ComboCtrl as well) when embedded in a AUI (wx.lib.agw.aui or wx.aui) floating pane that can be closed and re-opened (hidden via the “x” close button in the floating pane and shown again by some other action).

Please consider the sample app attached to this message. After you start it up:

  1. Click on the “Launch” button: this will show a AUI floating pane containing a simple OwnerDrawnComboBox. Notice that you can interact with the combobox and the dropdown works all right

  2. Close the floating pane via the “x” button. This will not destroy the floating pane as it doesn’t have the DestroyOnClose() flag set

  3. Click again on the “Launch” button: The AUI floating pane will be re-shown again. Notice that the OwnerDrawnComboBox does not react anymore - i.e., no dropdown is shown, it’s unusable.

This is on Windows 10 64 bit, Python 3.9.10 wxPython 4.2.1a1.dev5553+986d79b9 msw (phoenix) wxWidgets 3.2.2 - but it happens also with the regular wxPython 4.2.0.

It happens with wx.lib.agw.aui and wx.aui as well.

Any suggestion on what is going on is most welcome :slight_smile: . Thank you.

Andrea.

ownerdrawn_combobox.py (4.0 KB)

For what it’s worth, your code works correctly using Python 3.10.6 + wxPython 4.2.0 gtk3 (phoenix) wxWidgets 3.2.0 on Linux Mint 21.1.

After closing the floating pane and clicking the “Launch” button again, the OwnerDrawnComboBox is reacting normally. It shows the dropdown and I am able to select any option from it.

The only anomaly is that each time the floating pane is shown, a message similar to the following is written to the terminal:

13:12:59: Debug: ScreenToClient cannot work when toplevel window is not shown

Thank you for testing it. So it seems to work ok on GTK. But it doesn’t on any of the 4 Windows machines I’ve tried it on.

Maybe someone else with a Windows pc can test it? I’m sure I’m not allucinating…

Seeing quadruple, could be construed as the first sign of madness :wink:
Let’s hope it’s a Bug.

Hi Andrea,

The same bug occurs on my windows 10 PC, wx version 4.2.1a1.dev5545+a3b6cfec / Python 3.10.8.

I also investigated the combobox object and found that the child PopupTransientWindow has the wrong pos/size at the second popup.

Thank you @komoto48g for testing it on Windows, and to use the Widget Inspection Tool to show those ridiculous numbers for the popup position. No wonder I couldn’t see the popup, it’s like on Saturn…

So it wasn’t my fault :slight_smile:

I’m tempted to call it a wxWidgets bug, since it happens with the C++ wx.aui as well. Biggest problem next is to report it to the wxWidgets bug tracker, and I can already see people there dismissing it because it’s in Python and/or it uses wx.aui - that nobody apparently maintains anymore.

My knowledge of C++ being as large as the size of an atom, there’s no way I’ll be able to create a C++ sample to try and convince the wxWidgets guys to look at it.

I’ll try and report it anyway.

My current workaround is to destroy and recreate any control based on OwnerDrawnComboBox or wx.ComboCtrl every time the AUI pane is shown. But this is suboptimal and prone to other errors.

Seems like this has been recognised as a wxWidgets bug and fixed yesterday:

Is there anyone that can trigger a “nightly” build of wxPython so I can test it? Generally these snapshot builds live at Index of /Phoenix/snapshot-builds , but the latest available there is from the 4th of March…

I have no way to rebuild it on my work pc.

Thank you.