From de5d3a20ce90c2e8b084350e987097cb63fd2172 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 13 Jun 2003 22:30:55 +0000 Subject: [PATCH] SetSelection() may be used for both single and multi selection listboxes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21139 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/vlbox.tex | 28 ++++++++++++++++++++++++++++ src/generic/vlbox.cpp | 7 +++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/docs/latex/wx/vlbox.tex b/docs/latex/wx/vlbox.tex index 5b3f77a0ae..b2d16c7d77 100644 --- a/docs/latex/wx/vlbox.tex +++ b/docs/latex/wx/vlbox.tex @@ -173,6 +173,19 @@ may only return $0$ or $1$ however. Get the currently selected item or $-1$ if there is no selection. +\membersection{wxVListBox::GetSelectionBackground}\label{wxvlistboxgetselectionbackground} + +\constfunc{const wxColour\&}{GetSelectionBackground}{\void} + +Returns the background colour used for the selected cells. By default the +standard system colour is used. + +\wxheading{See also} + +\helpref{wxSystemSettings::GetColour}{wxsystemsettingsgetcolour},\\ +\helpref{SetSelectionBackground}{wxvlistboxsetselectionbackground} + + \membersection{wxVListBox::HasMultipleSelection}\label{wxvlistboxishasmultipleselection} \constfunc{bool}{HasMultipleSelection}{\void} @@ -321,6 +334,21 @@ Set the selection to the specified item, if it is $-1$ the selection is unset. The selected item will be automatically scrolled into view if it isn't currently visible. +This method may be used both with single and multiple selection listboxes. + + +\membersection{wxVListBox::SetSelectionBackground}\label{wxvlistboxsetselectionbackground} + +\func{void}{SetSelectionBackground}{\param{const wxColour\& }{col}} + +Sets the colour to be used for the selected cells background. The background of +the standard cells may be changed by simply calling +\helpref{SetBackgroundColour}{wxwindowsetbackgroundcolour}. + +\wxheading{See also} + +\helpref{GetSelectionBackground}{wxvlistboxgetselectionbackground} + \membersection{wxVListBox::Toggle}\label{wxvlistboxtoggle} diff --git a/src/generic/vlbox.cpp b/src/generic/vlbox.cpp index 86501ead57..938b9d331c 100644 --- a/src/generic/vlbox.cpp +++ b/src/generic/vlbox.cpp @@ -249,8 +249,11 @@ void wxVListBox::SetSelection(int selection) (selection >= 0 && (size_t)selection < GetItemCount()), _T("wxVListBox::SetSelection(): invalid item index") ); - wxASSERT_MSG( !HasMultipleSelection(), - _T("SetSelection() is invalid with multiselection listbox") ); + if ( HasMultipleSelection() ) + { + Select(selection); + m_anchor = selection; + } DoSetCurrent(selection); } -- 2.45.2