X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8a8e9df88a2983992b1588f8b6de8c05dcdf24f7..76bfdc9ad9107bb98b433c2bc367e11b7796c2c7:/src/richtext/richtextstyles.cpp diff --git a/src/richtext/richtextstyles.cpp b/src/richtext/richtextstyles.cpp index da627387e2..0b8782c756 100644 --- a/src/richtext/richtextstyles.cpp +++ b/src/richtext/richtextstyles.cpp @@ -955,8 +955,10 @@ wxRichTextCtrl* wxRichTextStyleListCtrl::GetRichTextCtrl() const /// Set/get the style type to display void wxRichTextStyleListCtrl::SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType) { - if (m_styleListBox) - m_styleListBox->SetStyleType(styleType); + if ( !m_styleListBox ) + return; + + m_styleListBox->SetStyleType(styleType); m_dontUpdate = true; @@ -1086,9 +1088,19 @@ bool wxRichTextStyleComboCtrl::Create(wxWindow* parent, wxWindowID id, const wxP void wxRichTextStyleComboCtrl::OnIdle(wxIdleEvent& event) { - if (GetRichTextCtrl() && !IsPopupShown() && m_stylePopup && wxWindow::FindFocus() != this) + event.Skip(); + + if ( !m_stylePopup ) + return; + + wxRichTextCtrl * const richtext = GetRichTextCtrl(); + if ( !richtext ) + return; + + if ( !IsPopupShown() && wxWindow::FindFocus() != this ) { - wxString styleName = wxRichTextStyleListBox::GetStyleToShowInIdleTime(GetRichTextCtrl(), m_stylePopup->GetStyleType()); + wxString styleName = + wxRichTextStyleListBox::GetStyleToShowInIdleTime(richtext, m_stylePopup->GetStyleType()); wxString currentValue = GetValue(); if (!styleName.IsEmpty()) @@ -1102,7 +1114,6 @@ void wxRichTextStyleComboCtrl::OnIdle(wxIdleEvent& event) else if (!currentValue.IsEmpty()) SetValue(wxEmptyString); } - event.Skip(); } #endif