From 8741f5374cd2582c645b30a7d0f75ce1d08c287a Mon Sep 17 00:00:00 2001 From: rods Date: Mon, 6 Jul 1998 21:30:08 +0000 Subject: [PATCH] Changed GetSelectedItem so it throws an exception when it is call by nsListBox git-svn-id: svn://10.0.0.236/trunk@5057 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/windows/nsListBox.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mozilla/widget/src/windows/nsListBox.cpp b/mozilla/widget/src/windows/nsListBox.cpp index 9b1ec1e3b7b..e74fdd72a8f 100644 --- a/mozilla/widget/src/windows/nsListBox.cpp +++ b/mozilla/widget/src/windows/nsListBox.cpp @@ -120,8 +120,12 @@ PRBool nsListBox::GetItemAt(nsString& anItem, PRInt32 aPosition) //------------------------------------------------------------------------- void nsListBox::GetSelectedItem(nsString& aItem) { - int index = ::SendMessage(mWnd, LB_GETCURSEL, (int)0, (LPARAM)0); - GetItemAt(aItem, index); + if (!mMultiSelect) { + int index = ::SendMessage(mWnd, LB_GETCURSEL, (int)0, (LPARAM)0); + GetItemAt(aItem, index); + } else { + NS_ASSERTION(0, "Multi selection list box does not support GetSelectedItem()"); + } } //------------------------------------------------------------------------- @@ -134,7 +138,7 @@ PRInt32 nsListBox::GetSelectedIndex() if (!mMultiSelect) { return ::SendMessage(mWnd, LB_GETCURSEL, (int)0, (LPARAM)0); } else { - NS_ASSERTION(0, "Multi selection list box does not support GetSlectedIndex()"); + NS_ASSERTION(0, "Multi selection list box does not support GetSelectedIndex()"); } return 0; } @@ -185,7 +189,9 @@ void nsListBox::GetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize) //------------------------------------------------------------------------- void nsListBox::SetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize) { - //::SendMessage(mWnd, LB_SETSELITEMS, (int)aSize, (LPARAM)aIndices); + for (int i=0;i