Add wxTextEntry::ClickDefaultButtonIfPossible() to wxMSW
Factor out this function from wxTextCtrl to allow its reuse in wxComboBox in the upcoming commit. No real changes, this is a pure refactoring.
This commit is contained in:
@@ -81,6 +81,10 @@ protected:
|
|||||||
virtual bool DoAutoCompleteCustom(wxTextCompleter *completer) wxOVERRIDE;
|
virtual bool DoAutoCompleteCustom(wxTextCompleter *completer) wxOVERRIDE;
|
||||||
#endif // wxUSE_OLE
|
#endif // wxUSE_OLE
|
||||||
|
|
||||||
|
// Helper for wxTE_PROCESS_ENTER handling: activates the default button in
|
||||||
|
// the dialog containing this control if any.
|
||||||
|
bool ClickDefaultButtonIfPossible();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// implement this to return the HWND of the EDIT control
|
// implement this to return the HWND of the EDIT control
|
||||||
virtual WXHWND GetEditHWND() const = 0;
|
virtual WXHWND GetEditHWND() const = 0;
|
||||||
|
@@ -2191,10 +2191,9 @@ wxTextCtrl::MSWHandleMessage(WXLRESULT *rc,
|
|||||||
if ( nMsg == WM_CHAR &&
|
if ( nMsg == WM_CHAR &&
|
||||||
!processed &&
|
!processed &&
|
||||||
HasFlag(wxTE_PROCESS_ENTER) &&
|
HasFlag(wxTE_PROCESS_ENTER) &&
|
||||||
wParam == VK_RETURN &&
|
wParam == VK_RETURN )
|
||||||
!wxIsAnyModifierDown() )
|
|
||||||
{
|
{
|
||||||
MSWClickButtonIfPossible(MSWGetDefaultButtonFor(this));
|
ClickDefaultButtonIfPossible();
|
||||||
|
|
||||||
processed = true;
|
processed = true;
|
||||||
}
|
}
|
||||||
|
@@ -1036,4 +1036,15 @@ wxPoint wxTextEntry::DoGetMargins() const
|
|||||||
return wxPoint(left, top);
|
return wxPoint(left, top);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// input handling
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool wxTextEntry::ClickDefaultButtonIfPossible()
|
||||||
|
{
|
||||||
|
return !wxIsAnyModifierDown() &&
|
||||||
|
wxWindow::MSWClickButtonIfPossible(
|
||||||
|
wxWindow::MSWGetDefaultButtonFor(GetEditableWindow()));
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_TEXTCTRL || wxUSE_COMBOBOX
|
#endif // wxUSE_TEXTCTRL || wxUSE_COMBOBOX
|
||||||
|
Reference in New Issue
Block a user