Tested with both -- a target works also with both.
But when I set unitprefix no button (frame) appears.
Secure(Unit|Action)ButtonTemplate frames don't magically have an appearance. You have to SetPoint and SetWidth/SetHeight and SetBackdrop just like any other frame.
oRA2 uses secure headers and "child buttons".
I also took a look at MainAssist -- wich contains the same code as in oRA2.
@Pacemaker
Yes the button has a size and so on.
Maybe my english is to bad (sorry I'm from Austria) but I thought I stated, that I can produce a button for a unit directly.
You quoted my "Tested with both -- a target works also with both."
So to be more detailed.
Setting up a button for (lets say) "raid1" works.
I see the button - if I click it it targets the unit -- everything like expected!!
And it does not matter if I use Unit or Action Button.
But as soon as I set f:SetAttribute("unitsuffix", "target") the button is no longer functional.
Sorry about the confusion with "no longer appears".
This was a mistake I made by setting different attributes.
Simple:
Lets assume the Raidmember is named Sepp.
I create the button - call f:SetAttribute("unit", "Sepp")
--also I set the other things needed
And this works - I get a button - when I click it Sepp is targeted.
Next step - I call f:SetAttribute("unitsuffix", "target")
I still get the button - but clicking on it does nothing.
What I expect it to do is to target the target of Sepp.
Lets assume the Raidmember is named Sepp.
I create the button - call f:SetAttribute("unit", "Sepp")
--also I set the other things needed
And this works - I get a button - when I click it Sepp is targeted.
Next step - I call f:SetAttribute("unitsuffix", "target")
I still get the button - but clicking on it does nothing.
What I expect it to do is to target the target of Sepp.
Ah. You want to set the unitsuffix to "-target" if you're using the name of a raid/party member. See http://www.wowwiki.com/UnitId for why.
Today I gave it massive tests.
I found out -- neither self.tf:SetAttribute("unitsuffix", "target") nor self.tf:SetAttribute("unitsuffix", "-target") do work if you act with unitnames.
If I use RaidX or PartyX it works - no matter if I use -target or target.
So to have such buttons I have to act with RaidX or PartyX and it works like it should - Names are only supported with the unit itself.
I can create a secure button for some raidmember.
Code looks something like this:
For a targetframe I tried
there is also a
f:SetAttribute("useparent-unit", true)
I'm not sure what it does - and anyhow it changes nothing if I set it or not.
I googled around a lot - but the documentation you can find for secureframes is more than poor.
Anyone any idea?
http://www.iriel.org/wow/docs/SecureHeadersGuide%20-%20pre1.pdf
Even from the site main address there is no link to this document.
Anyhow - it is interesting and it shows a lot of deep details about SecureHandlers -- but nothing about the things I'm looking for -- SecureTemplates.
I found something on wowwiki - but most of it are assumptions or "red entries" (no info available).
But when I set unitprefix no button (frame) appears.
Secure(Unit|Action)ButtonTemplate frames don't magically have an appearance. You have to SetPoint and SetWidth/SetHeight and SetBackdrop just like any other frame.
My hunch is that you must "register" the unit to be tracked by the Secure system. i.e.
I also took a look at MainAssist -- wich contains the same code as in oRA2.
@Pacemaker
Yes the button has a size and so on.
Maybe my english is to bad (sorry I'm from Austria) but I thought I stated, that I can produce a button for a unit directly.
You quoted my "Tested with both -- a target works also with both."
So to be more detailed.
Setting up a button for (lets say) "raid1" works.
I see the button - if I click it it targets the unit -- everything like expected!!
And it does not matter if I use Unit or Action Button.
But as soon as I set f:SetAttribute("unitsuffix", "target") the button is no longer functional.
Sorry about the confusion with "no longer appears".
This was a mistake I made by setting different attributes.
Simple:
Lets assume the Raidmember is named Sepp.
I create the button - call f:SetAttribute("unit", "Sepp")
--also I set the other things needed
And this works - I get a button - when I click it Sepp is targeted.
Next step - I call f:SetAttribute("unitsuffix", "target")
I still get the button - but clicking on it does nothing.
What I expect it to do is to target the target of Sepp.
Ah. You want to set the unitsuffix to "-target" if you're using the name of a raid/party member. See http://www.wowwiki.com/UnitId for why.
BUT - it sounds very logical!!!
So maybe you helped me a lot with pointing to that f... hyphen :)
He found it here: http://forums.worldofwarcraft.com/thread.html;jsessionid=BA47D31A224EBC480C6BED87C2E87F37.app23_04?topicId=11162847431&sid=1
a look to the thread points me to -- I do almost everything like it should be - except of the hyphen in front of target :)
Anyhow - your info (link) was helpfull too since it pointed me to some interesting things.
Hopefully my realmpool Todesbringer EU will come back on soon - so I can give the things a try.
I found out -- neither self.tf:SetAttribute("unitsuffix", "target") nor self.tf:SetAttribute("unitsuffix", "-target") do work if you act with unitnames.
If I use RaidX or PartyX it works - no matter if I use -target or target.
So to have such buttons I have to act with RaidX or PartyX and it works like it should - Names are only supported with the unit itself.
Edit: Way not use group headers? I used them when adding MT / MA and "PlayerTargets" and their targets (like CTRaid) to oUF_HolySmurf.
I'd recommend you take a look at this page: http://wowprogramming.com/docs/secure_template/Group_Headers
and in particular Filtering -> nameList. Even tho it's just one player, it can still be a list :)
Anyhow -- after finding out that there is only a problem with unitnames I got my thing working.
Thanks @all for tips and help