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
This commit is contained in:
rods
1998-07-06 21:30:08 +00:00
parent ead43eee9f
commit 8741f5374c

View File

@@ -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<aSize;i++) {
SelectItem(aIndices[i]);
}
}
//-------------------------------------------------------------------------