Search code examples
macoscocoawxpythonwxwidgets

Discontinuous multiple selection for vListBox or HtmlListbox doesn't work on OS X in wxWidgets / wxPython


I'm trying to create a cross-platform wxPython application which uses the HtmlListBox widget to list multiple multi-line items with formatting. It is working well on Ubuntu and Windows.

On OS X shift-click works to select multiple items in a row, but Command click does not work to select multiple discontinuous items; Control-click works fine on both Ubuntu and Windows.

I tried using a 32-bit Carbon build instead of the Cocoa build and that did work as expected (but had other problems). Command-click to select multiple discontinuous items does work in a normal ListBox widget on Cocoa builds, but I note neither VListBox nor HtmlListBox actually inherit ListBox, it seems.

No combination of LB_EXTENDED or LB_MULTIPLE flags seem to rectify this problem. I've confirmed it is the case in the HTML List example that ships in the latest wxWidgets (3.0). I also tried older 2.9 version builds and the problem was there too.

I found some old bug reports for similar problems but they seem resolved some years ago. I had a poke around in the wxWidgets source but didn't have much luck finding anything.

Is this a bug or am I missing something?


Solution

  • Looking at the sources I see that under Mac we use Apple-click and not Cmd-click for selecting individual items for some reason. I guess this is just a mistake, so I went ahead and fixed it.