summaryrefslogtreecommitdiff
path: root/indra/llui/llcombobox.cpp
diff options
context:
space:
mode:
authorRichard Nelson <richard@lindenlab.com>2009-08-04 01:12:59 +0000
committerRichard Nelson <richard@lindenlab.com>2009-08-04 01:12:59 +0000
commiteb853f55c07ae4a3c3f2aa05fbabcf2e4b4dc115 (patch)
tree7707fccb8d0946b6257d5ed7c5dfd3941c53eec0 /indra/llui/llcombobox.cpp
parentdb5cda26676f376f18816013c0c5e3fbad5b20d0 (diff)
svn merge -r 128442:129343 svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-18 into svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-2.0.0-3
Diffstat (limited to 'indra/llui/llcombobox.cpp')
-rw-r--r--indra/llui/llcombobox.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 45423920d6..f8c6204afb 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -100,7 +100,8 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
mPrearrangeCallback(p.prearrange_callback()),
mTextEntryCallback(p.text_entry_callback()),
mSelectionCallback(p.selection_callback()),
- mListPosition(p.list_position)
+ mListPosition(p.list_position),
+ mLastSelectedIndex(-1)
{
// Text label button
@@ -625,15 +626,15 @@ void LLComboBox::showList()
mList->setVisible(TRUE);
setUseBoundingRect(TRUE);
+
+ mList->sortItems();
+ mLastSelectedIndex = mList->getFirstSelectedIndex();
}
void LLComboBox::hideList()
{
- //*HACK: store the original value explicitly somewhere, not just in label
- std::string orig_selection = mAllowTextEntry ? mTextEntry->getText() : mButton->getLabelSelected();
-
// assert selection in list
- mList->selectItemByLabel(orig_selection, FALSE);
+ mList->selectNthItem(mLastSelectedIndex);
mButton->setToggleState(FALSE);
mList->setVisible(FALSE);
@@ -691,6 +692,7 @@ void LLComboBox::onItemSelected(const LLSD& data)
const std::string name = mList->getSelectedItemLabel();
S32 cur_id = getCurrentIndex();
+ mLastSelectedIndex = cur_id;
if (cur_id != -1)
{
setLabel(name);