diff options
author | Seth ProductEngine <slitovchuk@productengine.com> | 2011-02-25 23:19:18 +0200 |
---|---|---|
committer | Seth ProductEngine <slitovchuk@productengine.com> | 2011-02-25 23:19:18 +0200 |
commit | 1c3b95f5cc2c5e5bcf1f8b34a63ba8aa9d23ad81 (patch) | |
tree | 8a634b3f0c3cc6081fe42604428737e80a8f808c /indra/llui/llcombobox.cpp | |
parent | 9962560f57eb4bcf1b3451f5d86c963d5d6fcf5c (diff) |
STORM-1015 FIXED the ability to select an item from combo list if its name is not unique.
Updating combo box label upon list item selection does not search the item by label but takes the label of currently selected item instead.
Diffstat (limited to 'indra/llui/llcombobox.cpp')
-rw-r--r-- | indra/llui/llcombobox.cpp | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 8b6a73af56..6f9893b07a 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -316,7 +316,7 @@ void LLComboBox::setValue(const LLSD& value) LLScrollListItem* item = mList->getFirstSelected(); if (item) { - setLabel(getSelectedItemLabel()); + updateLabel(); } mLastSelectedIndex = mList->getFirstSelectedIndex(); } @@ -384,6 +384,23 @@ void LLComboBox::setLabel(const LLStringExplicit& name) } } +void LLComboBox::updateLabel() +{ + // Update the combo editor with the selected + // item label. + if (mTextEntry) + { + mTextEntry->setText(getSelectedItemLabel()); + mTextEntry->setTentative(FALSE); + } + + // If combo box doesn't allow text entry update + // the combo button label. + if (!mAllowTextEntry) + { + mButton->setLabel(getSelectedItemLabel()); + } +} BOOL LLComboBox::remove(const std::string& name) { @@ -701,13 +718,13 @@ void LLComboBox::onItemSelected(const LLSD& data) mLastSelectedIndex = getCurrentIndex(); if (mLastSelectedIndex != -1) { - setLabel(getSelectedItemLabel()); + updateLabel(); if (mAllowTextEntry) - { - gFocusMgr.setKeyboardFocus(mTextEntry); - mTextEntry->selectAll(); - } + { + gFocusMgr.setKeyboardFocus(mTextEntry); + mTextEntry->selectAll(); + } } // hiding the list reasserts the old value stored in the text editor/dropdown button hideList(); |