View Single Post
06-26-21, 07:06 PM   #10
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
A quick example if anyone wants to try.
Code:
local f = CreateFrame("Button", "Fizz_TargetDummy", UIParent, "SecureUnitButtonTemplate")
f:SetSize(65, 30)
f:SetPoint("CENTER", -400, 0)
f:SetAttribute("unit", "target")
RegisterUnitWatch(f)
f.t = CreateFrame("Button", nil, f, "UIPanelButtonTemplate") -- non secure frame to toggle
f.t:SetAllPoints()
f.t:SetText("And Me!")
f.t:SetScript("OnClick", function(self)
	print("Clicked!") 
end)

local b = CreateFrame("Button", nil, UIParent, "UIPanelButtonTemplate")
b:SetSize(140, 30)
b:SetPoint("RIGHT", f, "LEFT", -2, 0)
b:SetText("Click Me In Combat!")
b:SetScript("OnClick", function(self)
	f.t:SetShown(not f.t:IsShown()) -- toggle non secure frame
end)
The non secure button frame can be shown/hidden and clicked in combat.

Edit: Silly VM wouldn't update the code section.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 06-26-21 at 09:34 PM.
  Reply With Quote