So, I started to mess with derma yesterday, and it was really interesting. Until I came into to a problem. I made two frames, but I had no clue how I could make them both close at the same time. So I started to ask a few friends and eventually post it in the Garry’s Mod Discussions, but I recieved no answer that actually worked. So now I’m here asking for help.
This is the code I currently have, there are no lua errors or anything.
local Frame = vgui.Create( "DFrame" )
Frame:SetSize(200,1200)
Frame:SetTitle( "Wanker" )
Frame:SetPos(0,0)
Frame:SetVisible( true )
Frame:SetDraggable( false )
Frame:ShowCloseButton( true )
Frame:MakePopup()
Frame.Paint = function(self,w,h)
draw.RoundedBox(0,0,0,w,h, Color(32,36,47))
end
local close = vgui.Create("DButton", Frame)
close:SetSize(100,30)
close:SetPos(50,50)
close:SetText("Close")
close:SetTextColor(Color( 255,255,255))
close.Paint = function(self,w,h)
draw.RoundedBox(0,0,0,w,h, Color(41,128,185,250))
end
close.DoClick = function ()
close:Remove()
Frame:Remove()
gui.EnableScreenClicker(false)
net.Start("CS_MenuClosed")
net.SendToServer()
end
local Frame = vgui.Create("DFrame")
Frame:SetSize(1137,1200)
Frame:SetPos(783,0)
Frame:SetTitle ("Test")
Frame:SetVisible(true)
Frame:SetDraggable(false)
Frame:ShowCloseButton(true)
Frame:MakePopup()
Frame.Paint = function(self,w,h)
draw.RoundedBox(0,0,0,w,h, Color(32,36,47))
end
And this is what the it looks like: