]> git.saurik.com Git - wxWidgets.git/commitdiff
SetSelection() may be used for both single and multi selection listboxes
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 13 Jun 2003 22:30:55 +0000 (22:30 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 13 Jun 2003 22:30:55 +0000 (22:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21139 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/vlbox.tex
src/generic/vlbox.cpp

index 5b3f77a0aec510cdd6de7229c59facf2cad76fb1..b2d16c7d77236f1134e6918d2eb6c6ef1f146365 100644 (file)
@@ -173,6 +173,19 @@ may only return $0$ or $1$ however.
 Get the currently selected item or $-1$ if there is no selection.
 
 
 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}
 \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.
 
 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}
 
 
 \membersection{wxVListBox::Toggle}\label{wxvlistboxtoggle}
 
index 86501ead577034d4827e9063200a250793c4b7ef..938b9d331c76d8780cd5e28d81b18bdbf8f920f3 100644 (file)
@@ -249,8 +249,11 @@ void wxVListBox::SetSelection(int selection)
                   (selection >= 0 && (size_t)selection < GetItemCount()),
                   _T("wxVListBox::SetSelection(): invalid item index") );
 
                   (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);
 }
 
     DoSetCurrent(selection);
 }