Jump to content
Alloder.pro: about Allods with love
Search In
  • More options...
Find results that contain...
Find results in...

New program for writers

We turn from quantity to quality and tell you how we will supplement the Allods Team program with rewards in rubles.

More

The new Updater

Let us to introduce the new addon updater software and to share the details

Read more

Alloder 2.0

We have started the process of project evolve, and this relates not only, and not even primarily of the site's view

Read more

Реакция для кнопок


Loss
 Share

Recommended Posts

Столкнулся с такой проблемой. Мне нужно создавать кнопки из готовой в коде lua. Я делаю это таким кодом:

Code:
local desc = wtButton:GetWidgetDesc()

local wtButton1 = mainForm:CreateWidgetByDesc( desc )

wtMain:AddChild( wtButton1 )

Но проблема в том что я не могу сменить реакцию на нажатие. Точнее не знаю как это сделать. В документации этого нет. Есть какие нибудь предложения?

Link to comment
Share on other sites

Нельзя ее сменить из скрипта. Бери виджет из параметров реакции и ориентируйся по нему. Ему можно имя поменять по крайней мере.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

By using our site you agree to the Terms of Use