Don't send EVT_TEXT_ENTER to controls without wxTE_PROCESS_ENTER

wxMSW always sent this event to multiline text controls, even when they
didn't have wxTE_PROCESS_ENTER style, contrary to what was documented.

Avoid sending this event unless wxTE_PROCESS_ENTER is used and add unit
tests checking that multiline text controls don't get it without this
style (but still do get it with it).
This commit is contained in:
Vadim Zeitlin
2019-09-08 18:50:02 +02:00
parent 4c075c2128
commit 84f29ce472
5 changed files with 84 additions and 5 deletions

View File

@@ -1274,7 +1274,8 @@ TEST_CASE("wxTextCtrl::ProcessEnter", "[wxTextCtrl][enter]")
class TextCtrlCreator : public TextLikeControlCreator
{
public:
explicit TextCtrlCreator()
explicit TextCtrlCreator(int styleToAdd = 0)
: m_styleToAdd(styleToAdd)
{
}
@@ -1282,8 +1283,16 @@ TEST_CASE("wxTextCtrl::ProcessEnter", "[wxTextCtrl][enter]")
{
return new wxTextCtrl(parent, wxID_ANY, wxString(),
wxDefaultPosition, wxDefaultSize,
style);
style | m_styleToAdd);
}
virtual TextLikeControlCreator* CloneAsMultiLine() const wxOVERRIDE
{
return new TextCtrlCreator(wxTE_MULTILINE);
}
private:
int m_styleToAdd;
};
TestProcessEnter(TextCtrlCreator());