Loss Posted February 23, 2011 Share Posted February 23, 2011 Столкнулся с такой проблемой. Мне нужно создавать кнопки из готовой в коде lua. Я делаю это таким кодом: Code: local desc = wtButton:GetWidgetDesc() local wtButton1 = mainForm:CreateWidgetByDesc( desc ) wtMain:AddChild( wtButton1 ) Но проблема в том что я не могу сменить реакцию на нажатие. Точнее не знаю как это сделать. В документации этого нет. Есть какие нибудь предложения? Quote Link to comment Share on other sites More sharing options...
ramirez Posted February 23, 2011 Share Posted February 23, 2011 Нельзя ее сменить из скрипта. Бери виджет из параметров реакции и ориентируйся по нему. Ему можно имя поменять по крайней мере. Quote Link to comment Share on other sites More sharing options...
Loss Posted February 23, 2011 Author Share Posted February 23, 2011 блин точно... там же передается в параметре имя виджета. Спасибо! Quote Link to comment Share on other sites More sharing options...
Ciuine Posted February 23, 2011 Share Posted February 23, 2011 Instead of changing the reaction, you can change the name of the button as viewed by the LUA. Code: wtButton1:SetName("NewName1") Then you can ask on the reaction what the name of the button is via params.sender. If params.sender == "NewName1" then do this.. There are examples of this code at work in WhisperWindow as there are only four reaction buttons total in the add-on. Quote Link to comment Share on other sites More sharing options...
Recommended Posts