3737#include " llui.h" // getRootView(), resolvePath()
3838#include " lluictrl.h"
3939#include " llerror.h"
40+ #include " llcombobox.h"
4041
4142
4243LLUIListener::LLUIListener ():
@@ -55,6 +56,12 @@ LLUIListener::LLUIListener():
5556 " current value as [\" value\" ] reply." ,
5657 &LLUIListener::getValue,
5758 LLSDMap (" path" , LLSD ())(" reply" , LLSD ()));
59+
60+ add (" setSelectedByValue" ,
61+ " For the combobox identified by the path in [\" path\" ] set selection by [\" value\" ],\n "
62+ " and return result as [\" reply\" ]" ,
63+ &LLUIListener::setSelectedByValue,
64+ llsd::map (" path" , LLSD (), " value" , LLSD (), " reply" , LLSD ()));
5865}
5966
6067void LLUIListener::call (const LLSD& event) const
@@ -99,3 +106,20 @@ void LLUIListener::getValue(const LLSD&event) const
99106
100107 sendReply (reply, event);
101108}
109+
110+ void LLUIListener::setSelectedByValue (const LLSD& event) const
111+ {
112+ Response response (LLSD (), event);
113+ std::string path (event[" path" ]);
114+ LLComboBox* combo_ctrl = dynamic_cast <LLComboBox*>(LLUI::getInstance ()->resolvePath (LLUI::getInstance ()->getRootView (), path));
115+ if (combo_ctrl)
116+ {
117+ response.setResponse (combo_ctrl->setSelectedByValue (event[" value" ], true ));
118+ return ;
119+ }
120+ else
121+ {
122+ LL_WARNS () << " Specified combobox doesn't exist: " << path << LL_ENDL;
123+ }
124+ response.setResponse (false );
125+ }
0 commit comments