catching wx.EVT_TEXT_ENTER in wxOSX_Cocoa ComboBox?

I’m trying to use a validator and catch the Enter key in a ComboBox, which will trigger ComboBox.Validate() and reformat the current value as necessary. On Mac and Linux under 2.8.12, this works:

self.Bind(wx.EVT_TEXT_ENTER, lambda evt: self.Validate(), self)

On wxOSX_Cocoa in 2.9.1/2, it doesn’t do anything. Is this an issue with the underlying native control, or a change in 2.9, and is there a workaround of any kind?

thanks,

Nat

I'm seeing the events in this sample. Do you?

comboenter.py (818 Bytes)

···

On 7/27/11 3:56 PM, Nat Echols wrote:

I'm trying to use a validator and catch the Enter key in a ComboBox,
which will trigger ComboBox.Validate() and reformat the current value as
necessary. On Mac and Linux under 2.8.12, this works:

     self.Bind(wx.EVT_TEXT_ENTER, lambda evt: self.Validate(), self)

On wxOSX_Cocoa in 2.9.1/2, it doesn't do anything. Is this an issue
with the underlying native control, or a change in 2.9, and is there a
workaround of any kind?

--
Robin Dunn
Software Craftsman

Sigh… yes, I didn’t realize I needed to include wx.TE_PROCESS_ENTER as part of the window style. Weirdly, this appears to be unnecessary on Carbon and Linux - although I’m also binding the event in the validator, which makes it a little more complicated.

thanks,

Nat

···

On Thu, Jul 28, 2011 at 1:15 PM, Robin Dunn robin@alldunn.com wrote:

I’m seeing the events in this sample. Do you?