// static void LLComboBox::onItemSelected(LLUICtrl* item, void *userdata) { // Note: item is the LLScrollListCtrl LLComboBox *self = (LLComboBox *) userdata; const std::string name = self->mList->getSelectedItemLabel(); S32 cur_id = self->getCurrentIndex(); if (cur_id != -1) { self->setLabel(name); if (self->mAllowTextEntry) { gFocusMgr.setKeyboardFocus(self->mTextEntry); self->mTextEntry->selectAll(); } } // hiding the list reasserts the old value stored in the text editor/dropdown button self->hideList(); // commit does the reverse, asserting the value in the list self->onCommit(); }
//static void LLComboBox::onTextCommit(LLUICtrl* caller, void* user_data) { LLComboBox* self = (LLComboBox*)user_data; std::string text = self->mTextEntry->getText(); self->setSimple(text); self->onCommit(); self->mTextEntry->selectAll(); }