/// Set selection for string int wxRichTextStyleListBox::SetStyleSelection(const wxString& name) { int i = GetIndexForStyle(name); if (i > -1) SetSelection(i); return i; }
/// Set selection for string int wxRichTextStyleListBox::SetStyleSelection(const wxString& name) { int i = GetIndexForStyle(name); if (i > -1) { SetSelection(i); if (!IsVisible(i)) ScrollToRow(i); } return i; }
/// Auto-select from style under caret in idle time void wxRichTextStyleListBox::OnIdle(wxIdleEvent& event) { if (CanAutoSetSelection() && GetRichTextCtrl() && wxWindow::FindFocus() != this) { wxString styleName = GetStyleToShowInIdleTime(GetRichTextCtrl(), GetStyleType()); int sel = GetSelection(); if (!styleName.IsEmpty()) { // Don't do the selection if it's already set if (sel == GetIndexForStyle(styleName)) return; SetStyleSelection(styleName); } else if (sel != -1) SetSelection(-1); } event.Skip(); }