I have a ComboBox on a scrolledpanel and when choose from the choice
list associated with the combobox, cannot change the focus back to
the scrolledpanel by left clicking on it using the following event
handler:
So when I try to scroll the main window the ComboBox list actually
scrolls up and down.
This problem appears on Wondows (on Linux it works fine by itself
without event handler as soon as mouse cursor is moved outside of the
combobox.)
wxPython-2.9.3.1
As you've discovered only the widget with the focus gets the mouse wheel events on Windows, but on the other platforms it is the window under the cursor that gets the wheel events and focus doesn't matter.
A feature of panels in wx is that when they receive the focus they will normally not keep it for themselves and will set it to a child that accepts the focus if there is one. I think that is probably why you are seeing the focus appear to remain in the combo. The only way I know to avoid this is to make sure that the wx.TAB_TRAVERSAL style is not used on the scrolled panel, but you probably don't want that either. You could try catching scroll wheel events for every widget on the panel and then either redirect the events to the scrolled panel or just scroll it yourself...
···
On 1/18/12 2:00 PM, Ami Aleri wrote:
I have a ComboBox on a scrolledpanel and when choose from the choice
list associated with the combobox, cannot change the focus back to
the scrolledpanel by left clicking on it using the following event
handler:
So when I try to scroll the main window the ComboBox list actually
scrolls up and down.
This problem appears on Wondows (on Linux it works fine by itself
without event handler as soon as mouse cursor is moved outside of the
combobox.)
wxPython-2.9.3.1