Links |
---|
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
Patch 1.11.0 (2006-06-19): Consolidated to Region.[1]
Patch 1.9.0 (2006-01-03): Texture and FontString now have IsShown() and IsVisibility() similar to Frame[2]
- Previously
Texture:IsVisible()
andFontString:IsVisible
were similar toFrame:IsShown()
- Previously
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
- ^
slouken 2006-05-12. Re: Upcoming 1.11 Changes - Concise List. Archived from the original
- ^
slouken 2005-11-10. Re Upcoming 1.9 Changes - Concise List. Archived from the original