Fix wxCheckBox::SetValue() when in undetermined state with GTK
State becomes determined when SetValue() is called. See #24074
This commit is contained in:
parent
f587ef7c88
commit
edd1d758de
2 changed files with 8 additions and 2 deletions
|
|
@ -191,11 +191,14 @@ void wxCheckBox::SetValue( bool state )
|
|||
{
|
||||
wxCHECK_RET( m_widgetCheckbox != nullptr, wxT("invalid checkbox") );
|
||||
|
||||
if (state == GetValue())
|
||||
GtkToggleButton* tglbtn = GTK_TOGGLE_BUTTON(m_widgetCheckbox);
|
||||
|
||||
if (state == GetValue() && !gtk_toggle_button_get_inconsistent(tglbtn))
|
||||
return;
|
||||
|
||||
wxGtkEventsDisabler<wxCheckBox> noEvents(this);
|
||||
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(m_widgetCheckbox), state );
|
||||
gtk_toggle_button_set_active(tglbtn, state);
|
||||
gtk_toggle_button_set_inconsistent(tglbtn, false);
|
||||
}
|
||||
|
||||
bool wxCheckBox::GetValue() const
|
||||
|
|
|
|||
|
|
@ -138,6 +138,9 @@ void CheckBoxTestCase::ThirdStateUser()
|
|||
m_check->Set3StateValue(wxCHK_UNDETERMINED);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(wxCHK_UNDETERMINED, m_check->Get3StateValue());
|
||||
|
||||
m_check->SetValue(true);
|
||||
CPPUNIT_ASSERT_EQUAL(wxCHK_CHECKED, m_check->Get3StateValue());
|
||||
}
|
||||
|
||||
void CheckBoxTestCase::InvalidStyles()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue