Wowpedia
Advertisement
Wowpedia
240,483
pages

Regions, abstract rectangular areas where user interface elements are positioned, provide two functions to determine the current visibility state:

  • IsShown() - Indicates the region may appear, but not if it has a parent who is hidden
  • IsVisible() - Indicates the region is appearing (and so is its parent if it has one)
shown = Region:IsShown()
visible = Region:IsVisible()

Returns

shown 
boolean - true if the region is set to appear whenever its parent appears (or always if it has no parent)
visible 
boolean - true if the region is currently appearing

Details

  • IsShown reflects the most recent call to Region:Show(), Region:Hide() or Region:SetShown(boolean)
  • IsVisible reflects that a Region will not appear if it has a parent who is hidden
  • Regions constructed through XML schema default to being shown unless the hidden attribute is set to true
  • Regions constructed through lua functions CreateFrame(), Frame:CreateFontString() and Frame:CreateTexture() default to being shown unless inheriting from an XML template who is hidden
  • Hidden objects do not respond user interaction such as mouse hovering or clicking, nor do they trigger the OnUpdate handler
    • By contrast, setting a region's alpha (opacity) to zero will make it invisible to the human eye but it is still there and interactable

Example

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

Patch changes

See Also

  • UIObject:GetParent() - A region inherits visibility from its parent if it has one
  • Region:GetAlpha() - The amount of alpha, or opacity, is independent of a region being shown or hidden
  • OnUpdate - The OnUpdate event handler fires every frame while a frame is visible

References

Advertisement