change vgui material?

how do i change the material of a vgui panel?

//Thanks

Well, by default panels don’t use a texture to draw, but a background. However, if you wanted to draw a texture in the background you could do something like this:

[lua]function panel:Paint()
draw.TexturedQuad({
texture = surface.GetTextureID(“your/texture”),
color = color_white,
x = 0,
y = 0,
w = self:GetWide(),
h = self:GetTall(),
})
end[/lua]

Obviously replacing “your/texture” with the texture you want to use.

For reference:
**[Panel.Paint

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Panel.Paint)**
**[Draw.TexturedQuad

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Draw.TexturedQuad)**


function RPLicenseWeaponsTab()

	local weaponspanel = vgui.Create("DPanelList")
	weaponspanel:SetSpacing(1)
	weaponspanel:EnableHorizontal(false)
	weaponspanel:EnableVerticalScrollbar(true)
		function weaponspanel:Update()
			self:Clear(true)
			local Explanation = vgui.Create("DLabel")
			Explanation:SetText(LANGUAGE.license_tab)
			Explanation:SizeToContents()
			self:AddItem(Explanation)
			
			for k,v in pairs(DefaultWeapons) do
				if type(v) == "table" and v.name then
					local checkbox = vgui.Create("DCheckBoxLabel")
					checkbox:SetText(v.name)
					checkbox:SetValue(GetConVarNumber("licenseweapon_"..v.class))
					function checkbox.Button:Toggle()
						if ( self:GetChecked() == nil || !self:GetChecked() ) then 
							self:SetValue( true ) 
						else 
							self:SetValue( false ) 
						end 
						local tonum = {}
						tonum[false] = "0"
						tonum[true] = "1"
						RunConsoleCommand("rp_licenseweapon_".. v.class, tonum[self:GetChecked()])
					end
					self:AddItem(checkbox)
				end
			end
			
			local OtherWeps = vgui.Create("DLabel")
			OtherWeps:SetText(LANGUAGE.license_tab_other_weapons)
			OtherWeps:SizeToContents()
			self:AddItem(OtherWeps)
			for k,v in pairs(weapons.GetList()) do
				if type(v) == "table" and v.Classname then
					if v.Classname and not string.find(string.lower(v.Classname), "base") and v.Classname ~= "" then
						local checkbox = vgui.Create("DCheckBoxLabel")
						if v.PrintName then
							checkbox:SetText(v.PrintName)
						else
							checkbox:SetText(v.Classname)
						end
						checkbox:SetValue(GetConVarNumber("licenseweapon_"..v.Classname))
						function checkbox.Button:Toggle()
							if ( self:GetChecked() == nil || !self:GetChecked() ) then 
								self:SetValue( true ) 
							else 
								self:SetValue( false ) 
							end 
							local tonum = {}
							tonum[false] = "0"
							tonum[true] = "1"
							RunConsoleCommand("rp_licenseweapon_".. string.lower(v.Classname), tonum[self:GetChecked()])
						end
						self:AddItem(checkbox)
					end
				end
			end
		end
	weaponspanel:Update()
	return weaponspanel
end


where should i put it?

Anywhere before return weaponspanel.

im getting the error



GRSRP\gamemode\showteamtabs.lua:1176: attempt to index global 'panel' (a nil value)


and this is how it looks

http://img218.imageshack.us/img218/2913/picfor.jpg

Replace panel with weaponspanel.

thanks man , i learned something new today :slight_smile: