Help with VGUI/Derma Window

So i’m pretty new to this HUD and VGUI stuff and i’m trying to get the hang of it but i was confused about something… How would i make the button that i wrote close the entire Derma window when i press it? if you guys can help me out that’d be great :slight_smile:


local frame = vgui.Create("DFrame")
frame:SetSize(1700,70)
frame:SetPos(12,12)
frame:SetVisible(true)
frame:Center()
frame:MakePopup()
frame.Paint = function(s, w, h)

	draw.RoundedBox(5,0,0,w,h,Color(22, 23, 23, 100))
	draw.SimpleText( "YOU HAVE DIED, PLEASE FOLLOW OUR NLR (NEW LIFE RULE) ON THIS SERVER AND DO NOT RETURN TO THE LAST PLACE KILLED WITHIN 5 MINUTES! THANKS.", "Arial", 250, 10, Color(255, 255, 255, 255))

end

function buttonPressed()



end



local button = vgui.Create("DButton", frame)
button:SetPos(800,40)
button:SetSize(100,20)
button:SetText("I Agree")
button.DoClick = buttonPressed


Wanted to make it where when you press “I Agree” button it automaticly closes the entire derma panel. Sorry if this is obvious as i said im just learning about it :slight_smile:

[editline]19th February 2016[/editline]

I’ve tried a few things in the buttonPressed() Function none of them worked… If anyone has a solution let me know plz :slight_smile:



function buttonPressed()
    frame:Close()
end


?

Also, it’d be a good idea to make the buttonPressed function local

Wow well now i REALLY feel like a dumbass… Lol thanks a lot man worked :slight_smile:

[editline]19th February 2016[/editline]

Alright man thanks for the advice and help :slight_smile:

Just a tip - it might not be a bad idea if you look on the wiki for stuff like this, it has a list of all the possible functions and stuff you can use for panels (as well as pretty much everything else), so if you looked through that, you could probably find what you’re looking for a bit faster, so you wouldn’t have to test a bunch of things. For example, this is the page for the DFrame:Close function

[EDITLINE]Edited[/EDITLINE]

Just in case you didn’t know about that… you probably did though :stuck_out_tongue:

Yeah i was looking on there i didn’t see it… Guess my searching skills are pretty bad lol… Thanks though will def look it over better next time. :slight_smile: