Originally Posted by Resike
:IsVisible() and :IsShown() is totally different, :IsShown() also returns true if the frame is outside of the UIParent and shown, while :IsVisible() only returns true of the frame in inside of the UIParent and shown aka (visible).
|
This description is a bit confusing.
IsShown will be true for a frame that is explicitly shown, even when its parent is not.
IsVisible will only be true when it's visible and all parents up the hierarchy are too, which may or may not end at UIParent.
Lua Code:
parent:Hide()
child:Show()
---------------------------
child:IsShown() --> true
child:IsVisible() --> false
parent:Show()
child:Show()
---------------------------
child:IsShown() --> true
child:IsVisible() --> true
parent:Show()
child:Hide()
---------------------------
child:IsShown() --> false
child:IsVisible() --> false
For example, state swapping a frame from hidden to shown or vice versa should be done as frame:SetShown(not frame:IsShown()). Using something like frame:SetShown(not frame:IsVisible()) would become erratic if the parent of frame isn't visible at all times.