Opened 6 years ago

Closed 6 years ago

#14604 closed defect (fixed)

wx.SpinDoubleCtrl does not emit wxSpinDoubleEvent when ENTER key is pressed on MSW

Reported by: glhubbard Owned by: vadz
Priority: normal Milestone: 2.9.5
Component: wxMSW Version: 2.9.4
Keywords: Cc:
Blocked By: Blocking:
Patch: no


On MSW, and presumably any other platform using wxSpinCtrlGeneric to implement wx.SpinCtrlDouble, no event is emitted when the enter key is pressed.

This seems to be a wxWidgets bug, but as I only use wxPython, I am posting the bug here.

Examining the C++ source code, it seems like wxSpinCtrlGenericBase:: OnTextChar needs to handle the ENTER key.

I attempted to a workaround deriving my own subclass from wxSpinCtrlDouble, and binding to wx.EVT_CHAR, but the enter key never reaches my code, even though other characters do. I do not understand this.

This is my first ticket. Please correct me on anything I did incorrectly.

Change History (3)

comment:1 Changed 6 years ago by glhubbard

  • Status changed from new to confirmed

comment:2 Changed 6 years ago by vadz

  • Owner set to vadz
  • Status changed from confirmed to accepted

Thanks for the report, you're right, OnTextChar() is indeed needed, although in wxSpinCtrlTextGeneric and not wxSpinCtrlGeneric. As I was working on this code anyhow, I'll fix this and will commit the changes soon.

P.S. The only thing you did slightly wrong was to confirm your own ticket, usually someone else is supposed to confirm them, otherwise there is no point in the process of confirmation... We probably should add this to our submission guidelines.

comment:3 Changed 6 years ago by VZ

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [72415]) Generate wxEVT_COMMAND_TEXT_ENTER events for generic wxSpinCtrl.

Pass wxTE_PROCESS_ENTER to wxSpinCtrlTextGeneric if it's specified for
wxSpinCtrl itself and also forward wxEVT_COMMAND_TEXT_ENTER events from it to
wxSpinCtrl itself.

This fixes lack of these events for wxSpinCtrlDouble under MSW and also lack
of them for any kind of wxSpinCtrl in the ports using generic version (notably

Closes #14604.

Note: See TracTickets for help on using tickets.