Panel.HasParent

From GMod Wiki

Jump to: navigation, search
Function
Syntax Panel:HasParent( Panel P )
Description:
Returns true if panel 'P' is above this panel in the parenting hierarchy.
It does not return whether or not the panel has a parent.
Returns: Boolean
In Object: Panel
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Panel.HasParent]Panel.HasParent [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionExample
Used onNewerClient.png
Code
 
local Frame = vgui.Create("DFrame")
local Super = vgui.Create("DPanel")
local Sub = vgui.Create("DPanel")
 
Super:SetParent( Frame )
Sub:SetParent( Super )
 
print( "Super -> Frame", Super:HasParent( Frame ) )
print( "Sub   -> Super", Sub:HasParent  ( Super ) )
print( "Frame -> Super", Frame:HasParent( Super ) )
print( "Super -> Sub",   Super:HasParent( Sub ) )
 
OutputSuper -> Frame true
Sub -> Super true
Frame -> Super false
Super -> Sub false


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox