Override DoEnable() instead of Enable() in wxGTK controls
This is slightly simpler, as it doesn't require checking whether the control state really changes or not (it always does if DoEnable() is called) and allows disabling the controls before creating them, e.g. code like wxButton* const b = new wxButton(); b->Disable(); b->Create(this, wxID_OK); works as expected now instead of spewing GTK+ errors.
This commit is contained in:
@@ -1350,17 +1350,14 @@ void wxTextCtrl::SetEditable( bool editable )
|
||||
}
|
||||
}
|
||||
|
||||
bool wxTextCtrl::Enable( bool enable )
|
||||
void wxTextCtrl::DoEnable(bool enable)
|
||||
{
|
||||
if (!wxWindowBase::Enable(enable))
|
||||
{
|
||||
// nothing to do
|
||||
return false;
|
||||
}
|
||||
if ( !m_text )
|
||||
return;
|
||||
|
||||
wxTextCtrlBase::DoEnable(enable);
|
||||
|
||||
gtk_widget_set_sensitive( m_text, enable );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxTextCtrl::MarkDirty()
|
||||
|
Reference in New Issue
Block a user