Putting multiple buttons on one derma panel

So, I still haven’t figured out how to put multiple buttons on one derma panel.
Here is my code:

net.Receive( 'OpenIt', function()
		local base = vgui.Create( 'DFrame' )
			base:SetSize( 600, 300 )
			base:ShowCloseButton( true )
			base:SetDraggable( false )
			base:SetTitle( 'Admin Help' )
			function base:Paint( w, h )
				draw.RoundedBox( 0, 0, 0, w, h, Color( 0,0, 0 ) )
				surface.SetDrawColor( 33, 255, 0 )
				surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
		local button = vgui.Create( 'DButton' )
			button:SetParent( base )
			button:SetSize( 150, 100 )
			button:SetPos( 5, 26 )
			button:SetText( 'RDM' )
			button.DoClick = function()
			function button:Paint( w, h )
				draw.RoundedBox( 0, 0, 0, w, h, Color( 33, 255, 0 ) )
			RunConsoleCommand( "say", "@Help! I have been RDMed!" )
end )

Anyone know how I could do this?


Simply do the same thing with a new variable.

local button2 = vgui.Create( 'DButton' )
button2:SetParent( base )
button2:SetSize( 150, 100 )
button2:SetPos( 5, 26 )
button2:SetText( 'RDM' )
button2.DoClick = function()
function button2:Paint( w, h )
	draw.RoundedBox( 0, 0, 0, w, h, Color( 33, 255, 0 ) )
RunConsoleCommand( "say", "@Help! I have been RDMed!" )

Like I said before but you locked it before you replied (and your reply was inside my quote). You just make a new button how you would but change the varable. Also, do not use SetParent(), you can just do vgui.Create(“element”,parentnameifany). Another thing is, why do you have your VGUI in a net.Receive, I don’t think you’re understanding how net library works. Your base shouldn’t be local when testing (at least that’s what I do).

I would also suggest using something else as a NetworkString ‘OpenIt’ is too common.

I don’t see anything wrong with his net library. Just because YOU are using a different way of coding doesn’t mean he is wrong. I do the exact same thing whenever my panel isn’t registered as a VGUI and it worked pretty well so far.

Do the same thing you did the first time - create another DButton - except set the position differently so that it appears in a different area of the DFrame.

Also, you don’t have to call SetParent if, when you call vgui.Create, you pass the parent control in as a second parameter:

local button1 = vgui.Create( 'DButton', base)

EDIT: WOW, Triple-ninja’d.

Thank you guys so much!