Don't send events from wxTextCtrl::ChangeValue("") in wxGTK
ChangeValue() must not send events, but did in wxGTK when changing the contents of a wxTextCtrl to be empty when it had been non-empty before. Closes #18264.
This commit is contained in:
@@ -133,6 +133,7 @@ All (GUI):
|
|||||||
wxGTK:
|
wxGTK:
|
||||||
|
|
||||||
- Implement wxTextCtrl::HitTest() for single line controls.
|
- Implement wxTextCtrl::HitTest() for single line controls.
|
||||||
|
- Fix bug with wxTextCtrl::ChangeValue("") sending an unwanted event.
|
||||||
- Implement wxDataViewColumn::UnsetAsSortKey().
|
- Implement wxDataViewColumn::UnsetAsSortKey().
|
||||||
- Fix not showing wxInfoBar with GTK+ 3 < 3.22.29.
|
- Fix not showing wxInfoBar with GTK+ 3 < 3.22.29.
|
||||||
- Fix the build with glib < 2.32 (e.g. CentOS 6).
|
- Fix the build with glib < 2.32 (e.g. CentOS 6).
|
||||||
|
@@ -559,10 +559,20 @@ void wxTextEntry::DoSetValue(const wxString& value, int flags)
|
|||||||
EventsSuppressor noevents(this);
|
EventsSuppressor noevents(this);
|
||||||
Remove(0, -1);
|
Remove(0, -1);
|
||||||
}
|
}
|
||||||
EventsSuppressor noeventsIf(this, !(flags & SetValue_SendEvent));
|
|
||||||
|
// Testing whether value is empty here is more than just an
|
||||||
|
// optimization: WriteText() always generates an explicit event in
|
||||||
|
// wxGTK, which we need to avoid unless SetValue_SendEvent is given.
|
||||||
|
if ( !value.empty() )
|
||||||
|
{
|
||||||
|
// Suppress events from here even if we do need them, it's simpler
|
||||||
|
// to send the event below in all cases.
|
||||||
|
EventsSuppressor noevents(this);
|
||||||
WriteText(value);
|
WriteText(value);
|
||||||
}
|
}
|
||||||
else if (flags & SetValue_SendEvent)
|
}
|
||||||
|
|
||||||
|
if ( flags & SetValue_SendEvent )
|
||||||
SendTextUpdatedEvent(GetEditableWindow());
|
SendTextUpdatedEvent(GetEditableWindow());
|
||||||
|
|
||||||
SetInsertionPoint(0);
|
SetInsertionPoint(0);
|
||||||
|
@@ -87,6 +87,14 @@ void TextEntryTestCase::TextChangeEvents()
|
|||||||
entry->ChangeValue("");
|
entry->ChangeValue("");
|
||||||
CPPUNIT_ASSERT_EQUAL( 0, updated.GetCount() );
|
CPPUNIT_ASSERT_EQUAL( 0, updated.GetCount() );
|
||||||
updated.Clear();
|
updated.Clear();
|
||||||
|
|
||||||
|
entry->ChangeValue("non-empty");
|
||||||
|
CPPUNIT_ASSERT_EQUAL( 0, updated.GetCount() );
|
||||||
|
updated.Clear();
|
||||||
|
|
||||||
|
entry->ChangeValue("");
|
||||||
|
CPPUNIT_ASSERT_EQUAL( 0, updated.GetCount() );
|
||||||
|
updated.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEntryTestCase::CheckStringSelection(const char *sel)
|
void TextEntryTestCase::CheckStringSelection(const char *sel)
|
||||||
|
Reference in New Issue
Block a user