Thursday, April 19, 2012

Showing/Hiding frames

I'm trying to hide and show some art based one whether DUF_FocusFrame and DUF_TargetOfTargetFrame is visible. The first thing I could think of was the following code.


Code:
local UrkFocus = CreateFrame("Frame",UrkFocus,UIParent)
UrkFocus:SetFrameStrata("BACKGROUND")
UrkFocus:SetWidth(341.5)
UrkFocus:SetHeight(341.5)

local o = UrkFocus:CreateTexture(UrkFocus,"LOW")
o:SetTexture("Interface\\AddOns\\Urk\\Custom\\focus.tga")
o:SetAllPoints(UrkFocus)
UrkFocus.texture = o

UrkFocus:SetPoint("BOTTOM",100,13)
UrkFocus:Show()

local UrkTot = CreateFrame("Frame",urkTot,UIParent)
UrkTot:SetFrameStrata("BACKGROUND")
UrkTot:SetWidth(341.5)
UrkTot:SetHeight(341.5)

local p = UrkTot:CreateTexture(Urk,"LOW")
p:SetTexture("Interface\\AddOns\\Urk\\Custom\\tot.tga")
p:SetAllPoints(UrkTot)
UrkTot.texture = p

UrkTot:SetPoint("BOTTOM",-100,13)
UrkTot:Show()

--toggle arts
function UrkFocus_Toggle()
if ( DUF_FocusFrame:IsShown() ) then
UrkFocus:Show();
else
UrkFocus:Hide();
end
end

function UrkTot_Toggle()
if ( DUF_TargetOfTargetFrame:IsShown() ) then
UrkTot:Show();
else
UrkTot:Hide();
end
end

The problem is, this doesn't work; and I was hoping someone could help me figure out how to do it.

Thanks for any help.|||figured it out, nevermind.|||Quote:








figured it out, nevermind.




Glad you figured it out... but not sure which way you found. If this isn't the way you hit on, you might want to try this:

If you make the frame you want to associate with your parent frame instead of UIParent, then your frame will automatically be hidden when its new parent is hidden, and shown when its new parent is shown.

No comments:

Post a Comment