summaryrefslogtreecommitdiff
path: root/indra/llui/llcombobox.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-09-09 04:27:06 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-09-09 04:27:06 +0000
commit4601aef70abe611a2a25b3e236cc089ff2bcb6af (patch)
treead639e7d5c1724c64cc0d894ebceb017f57dd92b /indra/llui/llcombobox.cpp
parent579d8447d3269fc6ed747774f1b612a88d850781 (diff)
merge -r 1586-1593 https://svn.aws.productengine.com/secondlife/pe/stable-2 -> viewer-2.0.0-3
Fixes: EXT-839 EXT-859 EXT-868 EXT-795 EXT-861 EXT-678 EXT-848 EXT-873
Diffstat (limited to 'indra/llui/llcombobox.cpp')
-rw-r--r--indra/llui/llcombobox.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index ef0d4c1c03..58aeb61728 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -78,6 +78,7 @@ LLComboBox::ItemParams::ItemParams()
LLComboBox::Params::Params()
: allow_text_entry("allow_text_entry", false),
+ allow_new_values("allow_new_values", false),
show_text_as_tentative("show_text_as_tentative", true),
max_chars("max_chars", 20),
list_position("list_position", BELOW),
@@ -97,6 +98,7 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
mTextEntryTentative(p.show_text_as_tentative),
mHasAutocompletedText(false),
mAllowTextEntry(p.allow_text_entry),
+ mAllowNewValues(p.allow_new_values),
mMaxChars(p.max_chars),
mPrearrangeCallback(p.prearrange_callback()),
mTextEntryCallback(p.text_entry_callback()),
@@ -621,7 +623,15 @@ void LLComboBox::hideList()
if (mList->getVisible())
{
// assert selection in list
- mList->selectNthItem(mLastSelectedIndex);
+ if(mAllowNewValues)
+ {
+ // mLastSelectedIndex = -1 means that we entered a new value, don't select
+ // any of existing items in this case.
+ if(mLastSelectedIndex >= 0)
+ mList->selectNthItem(mLastSelectedIndex);
+ }
+ else
+ mList->selectNthItem(mLastSelectedIndex);
mButton->setToggleState(FALSE);
mList->setVisible(FALSE);