Panel.Valid

From GMod Wiki

Jump to: navigation, search
Function
Syntax Panel:Valid( )
Description:
Returns true if the Panel is really a valid Panel. Does it exist?
Returns: Boolean
In Object: Panel
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Panel.Valid]Panel.Valid [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionThis example will show you how to use the Panel:Valid in a clientside script.
Used onNewerClient.png
Code
function JustAFunction()
 
	LocalPlayer().MyPanelThing = LocalPlayer().MyPanelThing or NULL --We don't want any errors.
 
	local The_Panel = LocalPlayer().MyPanelThing --Give me my old frame.
 
	if( The_Panel:Valid() ) then return end --If the frame is still open, then stop this script.
 
	local new_panel = vgui.Create("DFrame")
	new_panel:SetSize(200,200)
	new_panel:SetPos(50,50)
	new_panel:SetTitle("A New Frame To Me")
	new_panel:MakePopup()
	LocalPlayer().MyPanelThing = new_panel --We got a new frame
 
end
concommand.Add("Make_A_New_Frame",JustAFunction)
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox