HOWTO: Integrate your addon with Clique (under Cataclysm/4.x)
Adding support for Clique - Non-Group-Headers
During the initialisation of your addon, do: Code:
ClickCastFrames = ClickCastFrames or {} Code:
ClickCastFrames[frameObject] = true Adding support for Clique - Group Headers Unfortunately there was a rather drastic change to the group headers in 4.x that cause the registration process to be a bit convoluted. There are four requirements:
The first step is simple, simply include the following in your table of contents file, required to ensure the header exist before you try and use it. Code:
## OptionalDeps: Clique Code:
<Button name="ClickCastUnitTemplate" virtual="true" inherits="SecureActionButtonTemplate,SecureHandlerEnterLeaveTemplate"> Code:
yourHeader:SetFrameRef("clickcast_header", ClickCastHeader) Code:
local header = self:GetParent():GetFrameRef("clickcast_header") |
You'll need to wrap the SetFrameRef like so:
Code:
if ClickCastHeader then |
That has the problem that is silently breaks, so that's why I did not suggest it.
|
You also should mention that you need to do:
SecureHandler_OnLoad(yourHeader) otherwise SetFrameRef isn't available on the frame. Alternatively you can just run: SecureHandlerSetFrameRef(yourHeader,"clickcast_header", ClickCastHeader) |
Correct, or you can inherit from the header base template.
|
You can't inherit it because the group headers already have an OnLoad.
|
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. |
Quote:
SecureHandler_OnLoad(yourHeader) That adds the methods that we get from SecureHandlerBaseTempate without conflicting! Quote:
Quote:
|
Is there a better way to do party frames? Without WoWs Secure Party Template?
I used to do my own layout but I had issues where I couldn't rearrange the buttons if I was in combat. Any ideas? If I'm doing it the "wrong" way I don't mind changing it. :banana: |
I'm not really sure I understand your question. If you want party frames, you can create them ahead of time without using the group headers. If you want frames created during combat without having to create all of them ahead of time, you can use the headers. That's what they are there for.
|
Quote:
Back to the question at hand. I know I can create the frames before combat but what happens when a UI is reloaded while in combat? I will not be able to create the frames right? Maybe I need to learn a little more about secure frames. Is there a time during load that you can create secure frames and move them around without tainting the system? Thanks again for your time. |
Quote:
|
Quote:
|
All times are GMT -6. The time now is 03:45 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI