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
This commit is contained in:
Vadim Zeitlin 2003-06-13 22:30:55 +00:00
parent 9a9b4940a1
commit de5d3a20ce
2 changed files with 33 additions and 2 deletions

View File

@ -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}

View File

@ -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);
}