diff options
Diffstat (limited to 'indra/llui')
-rwxr-xr-x | indra/llui/llcombobox.cpp | 5 | ||||
-rwxr-xr-x | indra/llui/llcombobox.h | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 56be52f69a..b32aea5ffa 100755 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -788,6 +788,11 @@ BOOL LLComboBox::handleKeyHere(KEY key, MASK mask) // since the dropdown button eats the key if (key == KEY_RETURN) { + if (mask == MASK_NONE) + { + mOnReturnSignal(this, getValue()); + } + // don't show list and don't eat key input when committing // free-form text entry with RETURN since user already knows // what they are trying to select diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 67393504e7..c9b1212b70 100755 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -199,6 +199,11 @@ public: void setTextEntryCallback( commit_callback_t cb ) { mTextEntryCallback = cb; } void setTextChangedCallback( commit_callback_t cb ) { mTextChangedCallback = cb; } + /** + * Connects callback to signal called when Return key is pressed. + */ + boost::signals2::connection setReturnCallback( const commit_signal_t::slot_type& cb ) { return mOnReturnSignal.connect(cb); } + void setButtonVisible(BOOL visible); void onButtonMouseDown(); @@ -231,6 +236,7 @@ private: commit_callback_t mTextChangedCallback; commit_callback_t mSelectionCallback; boost::signals2::connection mTopLostSignalConnection; + commit_signal_t mOnReturnSignal; S32 mLastSelectedIndex; }; |