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 wxOSX). Closes #14604. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72415 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -197,6 +197,7 @@ BEGIN_EVENT_TABLE(SpinBtnWidgetsPage, WidgetsPage)
|
||||
EVT_TEXT(SpinBtnPage_SpinCtrl, SpinBtnWidgetsPage::OnSpinText)
|
||||
EVT_TEXT_ENTER(SpinBtnPage_SpinCtrl, SpinBtnWidgetsPage::OnSpinTextEnter)
|
||||
EVT_TEXT(SpinBtnPage_SpinCtrlDouble, SpinBtnWidgetsPage::OnSpinText)
|
||||
EVT_TEXT_ENTER(SpinBtnPage_SpinCtrlDouble, SpinBtnWidgetsPage::OnSpinTextEnter)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, SpinBtnWidgetsPage::OnCheckOrRadioBox)
|
||||
EVT_RADIOBOX(wxID_ANY, SpinBtnWidgetsPage::OnCheckOrRadioBox)
|
||||
|
@@ -65,7 +65,7 @@ class wxSpinCtrlTextGeneric : public wxTextCtrl
|
||||
public:
|
||||
wxSpinCtrlTextGeneric(wxSpinCtrlGenericBase *spin, const wxString& value, long style=0)
|
||||
: wxTextCtrl(spin->GetParent(), wxID_ANY, value, wxDefaultPosition, wxDefaultSize,
|
||||
style & wxALIGN_MASK)
|
||||
style & (wxALIGN_MASK | wxTE_PROCESS_ENTER))
|
||||
{
|
||||
m_spin = spin;
|
||||
|
||||
@@ -84,8 +84,18 @@ public:
|
||||
|
||||
void OnChar( wxKeyEvent &event )
|
||||
{
|
||||
if (m_spin)
|
||||
m_spin->ProcessWindowEvent(event);
|
||||
if ( !m_spin->ProcessWindowEvent(event) )
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void OnTextEnter(wxCommandEvent& event)
|
||||
{
|
||||
// We need to forward this event to the spin control itself as it's
|
||||
// supposed to generate it if wxTE_PROCESS_ENTER is used with it.
|
||||
wxCommandEvent eventCopy(event);
|
||||
eventCopy.SetEventObject(m_spin);
|
||||
eventCopy.SetId(m_spin->GetId());
|
||||
m_spin->ProcessWindowEvent(eventCopy);
|
||||
}
|
||||
|
||||
void OnKillFocus(wxFocusEvent& event)
|
||||
@@ -104,6 +114,7 @@ private:
|
||||
|
||||
BEGIN_EVENT_TABLE(wxSpinCtrlTextGeneric, wxTextCtrl)
|
||||
EVT_CHAR(wxSpinCtrlTextGeneric::OnChar)
|
||||
EVT_TEXT_ENTER(wxID_ANY, wxSpinCtrlTextGeneric::OnTextEnter)
|
||||
|
||||
EVT_KILL_FOCUS(wxSpinCtrlTextGeneric::OnKillFocus)
|
||||
END_EVENT_TABLE()
|
||||
|
Reference in New Issue
Block a user