diff -r 1bc100746447 indra/llui/llcombobox.h --- a/indra/llui/llcombobox.h Wed Feb 23 11:41:13 2011 -0700 +++ b/indra/llui/llcombobox.h Fri Feb 25 23:13:20 2011 +0200 @@ -148,6 +148,9 @@ // This is probably a UI abuse. void setLabel(const LLStringExplicit& name); + // Updates the combobox label to match the selected list item. + void updateLabel(); + BOOL remove(const std::string& name); // remove item "name", return TRUE if found and removed BOOL setCurrentByIndex( S32 index ); diff -r 1bc100746447 indra/llui/llcombobox.cpp --- a/indra/llui/llcombobox.cpp Wed Feb 23 11:41:13 2011 -0700 +++ b/indra/llui/llcombobox.cpp Fri Feb 25 23:13:20 2011 +0200 @@ -316,7 +316,7 @@ LLScrollListItem* item = mList->getFirstSelected(); if (item) { - setLabel(getSelectedItemLabel()); + updateLabel(); } mLastSelectedIndex = mList->getFirstSelectedIndex(); } @@ -384,6 +384,23 @@ } } +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 @@ 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();