-
Posted by joe177 on Thu, 04 Feb 2010 22:12:19
Hello, I recently completed Chapter 27 and after making some changes to make it work with today's patch, I want to add some more features. I would like to make it so that when I click on the unit's frame/button it would make that unit the target. I understand that the SetAttribute function can do something like this but I do not know how I can do what I want. After examining your Perfect Raid addon, I saw some code of button:SetAttribute("*type1", "target"). If I modified that code to self:SetAttribute("unit", "target") would I get want I want?
Thank you.
-
Posted by jnwhiteh on Thu, 04 Feb 2010 23:14:10
Hello, I recently completed Chapter 27 and after making some changes to make it work with today's patch, I want to add some more features. I would like to make it so that when I click on the unit's frame/button it would make that unit the target. I understand that the SetAttribute function can do something like this but I do not know how I can do what I want. After examining your Perfect Raid addon, I saw some code of button:SetAttribute("*type1", "target"). If I modified that code to self:SetAttribute("unit", "target") would I get want I want?
Thank you.
First you would need to alter BasicUnitFrames to inherit from SecureActionButtonTemplate. This is how you add protected actions to your addon. Then you'd want to specify the following:
-- Tell the button what unit it represents self:SetAttribute("unit", "target") -- Set the button to target that unit on left-click self:SetAttribute("*type1", "target")
That should be it, but it's possible there's other things to do.