From d5af2588bc3da1cabf0a121eaf0238b07d8b9bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liru=20F=C3=A6rs?= Date: Mon, 21 Oct 2019 16:48:14 -0400 Subject: [PATCH] Let combo box label be default selection via xui --- indra/llui/llcombobox.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 7a5141da2..5a5eea43c 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -200,9 +200,14 @@ LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * // if we haven't already gotten a value from our control_name and // if providing user text entry or descriptive label // don't select an item under the hood - if (combo_box->getControlName().empty() && !combo_box->acceptsTextInput() && combo_box->mLabel.empty()) + if (combo_box->getControlName().empty()) { - combo_box->selectFirstItem(); + const auto text = combo_box->acceptsTextInput(); + std::string label; + if (node->getAttributeString("label", label)) + text ? combo_box->setLabel(label) : combo_box->mList->selectItemByLabel(label, FALSE); + else if (!text && combo_box->mLabel.empty()) + combo_box->selectFirstItem(); } return combo_box;