Added: onclick_r and onover Lua reflect properties. Setup id to buttonGroup to access it

--HG--
branch : patches-from-atys
hg/hotfix/patches-from-atys
ulukyn 7 years ago
parent 50d6ae91ae
commit 0093170ee9

@ -2749,18 +2749,19 @@ namespace NLGUI
string buttonTemplate = DefaultButtonGroup; string buttonTemplate = DefaultButtonGroup;
// Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name" // Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name"
string param = "name=" + this->_Id + "|url=" + getLink(); string param = "name=" + this->_Id + "|url=" + getLink();
string name = "";
if (!_AnchorName.empty())
name = _AnchorName.back();
typedef pair<string, string> TTmplParam; typedef pair<string, string> TTmplParam;
vector<TTmplParam> tmplParams; vector<TTmplParam> tmplParams;
tmplParams.push_back(TTmplParam("id", "")); tmplParams.push_back(TTmplParam("id", ""));
tmplParams.push_back(TTmplParam("onclick", "browse")); tmplParams.push_back(TTmplParam("onclick", "browse"));
tmplParams.push_back(TTmplParam("onclick_param", param)); tmplParams.push_back(TTmplParam("onclick_param", param));
tmplParams.push_back(TTmplParam("active", "true")); tmplParams.push_back(TTmplParam("active", "true"));
CInterfaceGroup *buttonGroup = CWidgetManager::getInstance()->getParser()->createGroupInstance(buttonTemplate, _Paragraph->getId(), tmplParams); CInterfaceGroup *buttonGroup = CWidgetManager::getInstance()->getParser()->createGroupInstance(buttonTemplate, getId()+":"+name, tmplParams);
if (buttonGroup) if (buttonGroup)
{ {
if (!_AnchorName.empty()) buttonGroup->setId(getId()+":"+name);
buttonGroup->setId(_AnchorName.back());
// Add the ctrl button // Add the ctrl button
CCtrlTextButton *ctrlButton = dynamic_cast<CCtrlTextButton*>(buttonGroup->getCtrl("button")); CCtrlTextButton *ctrlButton = dynamic_cast<CCtrlTextButton*>(buttonGroup->getCtrl("button"));
if (!ctrlButton) ctrlButton = dynamic_cast<CCtrlTextButton*>(buttonGroup->getCtrl("b")); if (!ctrlButton) ctrlButton = dynamic_cast<CCtrlTextButton*>(buttonGroup->getCtrl("b"));

Loading…
Cancel
Save