I have made bindings to bind my frame which inherits from the SecureHandlerMouseUpDownTemplate, and I thought that because my frame was keybound, it was intercepting my keybinds as mouse clicks, when the bind is down, the mouse is down, so to speak.
This doesnt appear to be the case in my addon, so is there a way that I can make a keybind show/hide a frame, even during combat. This frame has protected children.
I added the SecureClick template in trying new things, and this is copy-n-pasted, with some fluff removed for space
also, my bindings.xml used to include a function to toggle the frame, i removed it when added secure handlers, it worked out of combat before i changed.
.xml
Code:
<Frame name="myFrame" parent="UIParent" hidden="true" enableMouse="true" inherits="SecureHandlerClickTemplate, SecureHandlerMouseUpDownTemplate">
<Size x="256" y="256" />
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Scripts>
<OnLoad>
myFrame_OnLoad(self)
</OnLoad>
</Scripts>
</Frame>
.lua
Code:
_G["BINDING_NAME_CLICK myFrame:LeftButton"] = "Show Buttons"
function myFrame_OnLoad(frame)
frame:SetAttribute("_onmouseup", [=[self:Hide()]=])
frame:SetAttribute("_onmousedown", [=[self:Show()]=])
frame:SetAttribute("_onclick", [=[self:Show()]=])
end
bindings.xml
Code:
<Bindings>
<Binding name="Show Buttons" description="Show the Buttons" header="My Addon">
--foo
</Binding>
</Bindings>