Widget API: Region:IsShown

Revision as of 04:47, 15 August 2023 by Move page script (talk | contribs) (Move page script moved page API Region IsShown to API Region IsShown without leaving a redirect)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Widget API ← Region < IsShown

Determine if the object would be visible if its parent was visible.

shown = MyObject:IsShown();

ReturnsEdit

shown
boolean - true if the object will be visible when its parent is visible.

ExampleEdit

if MyFrame:IsShown() and not MyFrame:IsVisible() then
    -- Frame is "shown", but not visible (one or more of its parents isn't shown)
elseif MyFrame:IsVisible() then
    -- Frame is visible on-screen!
end

DetailsEdit

Calling :Show() on an object will make subsequent calls to IsShown() return true. Likewise, calling :Hide() will make subsequent calls to IsShown() return nil.

When an object is initialized, the return value of IsShown() is determined by the XML-attribute "hidden" for the object.

Objects created via CreateFrame(), Frame:CreateFontString() or Frame:CreateTexture() are initially created shown.

NotesEdit

  • Prior to patch 1.9, FontStrings did not have an :IsShown(). They did have an :IsVisible() method with the behaviour of :IsShown().

See alsoEdit