Close() for custom VGUI?

Title basically explains it. I’m making a panel based off DPanel. How can I code a close function into it? I’m not sure what DFrame does. =\

Edit:
[lua]function PANEL:Close()
self:SetVisible(false)
self = nil
end[/lua]

That works, but I’m not sure that it’s actually the right thing to do. I don’t want to cause any unneeded lag. If it’s just hiding it. shrug

[lua]
function PANEL:Close()
self:Remove()
self = nil
end
[/lua]

You could do that, but for better FPS just hide it.

[lua]
function PANEL:Close()
self:SetVisible( false )
end
[/lua]

I believe this is for a custom derma skin - hiding the frame just might not cut it. Nulling it is probably the best idea.

Yeah. It works well :slight_smile: Ty for the help on steam Flappyjack. And thanks for trying Horsey :smiley:

Hiding it doesn’t always give better FPS in the long run. Sure, you will get a quick open and close, but your calculations inside the VGUI will still take place if its in a Think hook, lowering your FPS slightly.

[editline]10:11AM[/editline]

SetVisible is a Panel function in all VGUI panels, it just sets the alpha to 0 and stops running the Draw hook.