OK, I got it mostly working. Here's what I have done.
My Party Frame had to inherit from both SecurePartyHeaderTemplate and SecureHandlerBaseTemplate.
Now I could do the Frame:SetFrameRef("clickcast_header", ClickCastHeader)";
I updated the initialConfigFunction as an attribute and used the following snippet for the value.
[[
local header = self:GetParent():GetFrameRef("clickcast_header")
-- do not add this conditional in without testing, it will allow for incorrect
-- integration, so you should verify it works before adding this check.
if header then
header:SetAttribute("clickcast_button", self)
header:RunAttribute("clickcast_register")
end
]];
My template for my unit button also needed to inherit from both SecureUnitButtonTemplate and SecureHandlerEnterLeaveTemplate.
I added the following attributes to the template also.
<Attributes>
<Attribute name="_onenter" type="string" value="local snippet = self:GetAttribute('clickcast_onenter'); if snippet then self:Run(snippet) end"/>
<Attribute name="_onleave" type="string" value="local snippet = self:GetAttribute('clickcast_onleave'); if snippet then self:Run(snippet) end"/>
</Attributes>
The only problems I have left are as follows.
How do I get the new buttons that are created into the ClickCastFrames table? The buttons are generated dynamically by SecurePartyHeaderTemplate and I don't get "notified" until the initialConfigFunction snippet is processed. I'm going to try to add it to the snippet but I'm not sure if that will work.
Also I can't seem to get the menu to work on my buttons. The menu works on the stock UI frames.
|