Simulating wxEvents

Hey people,

I'm using wxComboBox with my own extended search functionalities.
After catching EVT_CHAR on the TextCtrl of the ComboBox a Database search
is done - if the result is more than one row the ComboBox gets filled with the
rows from the result.
In that case I would like the ComboBox to magically pop-up just as if the user
clicked on the arrow, because if the user already is "inside" the ComboBox while
writing and pressing Enter for searching, he could continue with navigating
with the keyboard-arrow keys for example, instead of having to use the mouse again
for clicking on the ComboBox arrow.

Is there such a possibility in wxPython - i guess its at least not officially implemented,
as I didn't find much about that theme online.

The last thing I tried was:

···

###
nevent = wx.CommandEvent(wx.wxEVT_LEFT_DOWN)
nevent.SetId(obj.GetId())
obj.GetEventHandler().ProcessEvent(nevent)
###

"obj" being a button (for testing purposes).

Thanks in advance

--
Hannes Tismer
Software Development
Medical Display Solutions

Rein EDV GmbH Jakob-Krebs-Straße 124
D-47877 Willich

Fon: +49 2156 49490 Fax: +49 2156 494939

Visit us at www.medisol.org

See the ComboCtrl demo for wxPython 2.8 . It has a method that you can
call to pop up the listing.

- Josiah

···

Hannes Tismer <hannes@tismer.com> wrote:

Hey people,

I'm using wxComboBox with my own extended search functionalities.
After catching EVT_CHAR on the TextCtrl of the ComboBox a Database search
is done - if the result is more than one row the ComboBox gets filled
with the
rows from the result.
In that case I would like the ComboBox to magically pop-up just as if
the user
clicked on the arrow, because if the user already is "inside" the
ComboBox while
writing and pressing Enter for searching, he could continue with navigating
with the keyboard-arrow keys for example, instead of having to use the
mouse again
for clicking on the ComboBox arrow.

Is there such a possibility in wxPython - i guess its at least not
officially implemented,
as I didn't find much about that theme online.

The last thing I tried was:
###
nevent = wx.CommandEvent(wx.wxEVT_LEFT_DOWN)
nevent.SetId(obj.GetId())
obj.GetEventHandler().ProcessEvent(nevent)
###

"obj" being a button (for testing purposes).

Thanks in advance

--
Hannes Tismer
Software Development
Medical Display Solutions

Rein EDV GmbH
Jakob-Krebs-Straße 124
D-47877 Willich

Fon: +49 2156 49490
Fax: +49 2156 494939

Visit us at www.medisol.org

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Hannes Tismer wrote:

Hey people,

I'm using wxComboBox with my own extended search functionalities.
After catching EVT_CHAR on the TextCtrl of the ComboBox a Database search
is done - if the result is more than one row the ComboBox gets filled with the
rows from the result.
In that case I would like the ComboBox to magically pop-up just as if the user
clicked on the arrow, because if the user already is "inside" the ComboBox while
writing and pressing Enter for searching, he could continue with navigating
with the keyboard-arrow keys for example, instead of having to use the mouse again
for clicking on the ComboBox arrow.

Is there such a possibility in wxPython - i guess its at least not officially implemented,
as I didn't find much about that theme online.

No. For something like this you need to have the event be converted to the native equivalent and then sent to the native widget, and wx doesn't do that. The event handling system is only geared up to turn native events into wx events, not the other way around. To do it you'll need to call the native APIs using ctypes or something to send the right events.

Or as Josiah suggested you can use the new wx.combo.ComboCtrl to get more control over the widget.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!