DPropterySheet Custom Derma Buttons

A little infomation…

I’m trying to make a server F1 menu and almost have it completed, but i’m also trying to make it so there is 2 tabs on the page. The sad part is that the default derma buttons for the tabs are horrible I just want them like a normal “dButton” so I can can Paint() them to fit the style of the F1 menu itself. Is there anyway to hide the DPropertySheet Tab selection and use another derma operator to do the Sheet switching?

Current F1 menu without the tabs (style)

You can look at the original one and edit it:

Don’t know if you still need this, but I made something that should work like you wanted:


function Menu()
	local w = 446
	local h = 452
	local padding = 4
	
	local f = vgui.Create("DFrame")
	f:SetSize( w, h)
	f:SetPos( (ScrW()/2) - (w/2), (ScrH()/2) - (h/2) )
	f:SetTitle("Title")
	f:SetDraggable(false)
	f:ShowCloseButton(true)
	f:MakePopup()
	
	local ps = vgui.Create( "DPropertySheet", f)
	ps:SetPos( 8, 28 )
	ps:SetSize( w - 16, h - 36 )
	ps:SetFadeTime( 0 )
	ps.Paint = function() -- The paint function
    draw.RoundedBox( 6, 0, 0, w - 16, h - 36, Color( 150, 150, 150, 75 ) )
	for k,v in pairs(ps.Items) do --Hides the default tabs (must be inside a paint function)
	v.Tab:SetSize( 0, 0 )
	v.Tab:SetVisible( false )
	end	
	end
	
	local x,y = ps:GetPos()
	local Selected = 1 --Default selected tab
	
	local function SelectTabOne() --Called when tab 1 is selected
		if Selected == 1 then
		return Color(200, 200, 25, 200)
		else
		return Color(255, 255, 255, 255)
		end
	end
	
	local function SelectTabTwo() --Called when tab 2 is selected
		if Selected == 2 then
		return Color(200, 200, 25, 200)
		else
		return Color(255, 255, 255, 255)
		end
	end
	
	local TabText = "Tab 1"
	local dbutton = vgui.Create( "DButton", f )
	dbutton:SetSize( 70, 51 )
	dbutton:SetPos( x + 4, y - 23 )
	dbutton:SetText( "" )
	function dbutton:Paint() --Here we create the new propertysheet tab button
	draw.RoundedBox( 0, x, y, 200, 200, Color( 0, 0, 0, 75 ) )
	draw.SimpleText( TabText, "default", x+15-string.len(TabText)/2, y+4, SelectTabOne() )
	end
	dbutton.DoClick = function() --Changes text color of the selected tab to yellow and makes unselected tabs text color to white
	for k,v in pairs(ps.Items) do
	if k == 1 then
	ps:SetActiveTab(v.Tab)
	Selected = 1
	end
	end
	end
	
	local TabText2 = "Tab 2"
	local dbutton2 = vgui.Create( "DButton", f )
	dbutton2:SetSize( 70, 51 )
	dbutton2:SetPos( x + 70, y - 23 )
	dbutton2:SetText( "" )
	function dbutton2:Paint() --Here we create the new propertysheet tab button
	draw.RoundedBox( 0, x, y, 200, 200, Color( 0, 0, 0, 75 ) )
	draw.SimpleText( TabText2, "default", x+15-string.len(TabText2)/2, y+4, SelectTabTwo() )
	end
	dbutton2.DoClick = function() --Changes text color of the selected tab to yellow and makes unselected tabs text color to white
	for k,v in pairs(ps.Items) do
	if k == 2 then
	ps:SetActiveTab(v.Tab)
	Selected = 2
	end
	end
	end
	
	local list1 = vgui.Create( "DPanelList", ps )
	list1:SetPos( padding, padding )
	list1:SetSize( w - 24, h - 45)
	list1:EnableVerticalScrollbar( true )
	list1:EnableHorizontal( true )
	list1:SetPadding( padding )
	list1:SetSpacing( padding )
	function list1:Paint()
		draw.RoundedBox( 6, 0, 0, self:GetWide(), self:GetTall(), Color( 60, 60, 60 ) )
	end
	
	local tab1content = vgui.Create("DLabel", list1)
	tab1content:SetPos( 2, 2 )
	tab1content:SetSize( 200, 20 )
	tab1content:SetText( "Woop" )
	list1:AddItem(table1content)
	
	local list2 = vgui.Create( "DPanelList", ps )
	list2:SetPos( padding, padding )
	list2:SetSize( w - 24, h - 45)
	list2:EnableVerticalScrollbar( true )
	list2:EnableHorizontal( true )
	list2:SetPadding( padding )
	list2:SetSpacing( padding )
	function list2:Paint()
		draw.RoundedBox( 6, 0, 0, self:GetWide(), self:GetTall(), Color( 60, 60, 60 ) )
	end
	
	local tab2content = vgui.Create("DLabel", list2)
	tab2content:SetPos( 2, 2 )
	tab2content:SetSize( 200, 20 )
	tab2content:SetText( "Insert something here" )
	list2:AddItem(tab2content)
	
	ps:AddSheet( "Tab 1", list1, "icon16/box.png", true, false, "" )
	ps:AddSheet( "Tab 2", list2, "icon16/box.png", true, false, "" )
end
concommand.Add("menutest", Menu)