Hello, I wanted to know if this stuff like
[CODE]
function frame:Paint(w, h)
draw.RoundedBox( 0, 0, 0, w, h, Color(52, 73, 94) )
draw.RoundedBox( 0, 0, 22, w, h - 22, Color(44, 62, 80) )
end
[/CODE]
also exists for DPropertySheet? Because I would like to paint it like that, and on the gmodwiki is nothing about it, and mauritz.tv is outdated/doesnt show how to color the 'single' tabs, like inactive tabs have a different color.
Yeah. When you do mysheet = frame:AddSheet(), you can use mysheet.Tab:Paint(w, h) to override the tab painting. You can learn more about it by viewing the source [url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/vgui/dpropertysheet.lua#L149[/url]
starting at line 149 (stuff before that is other stuff)
Thanks, will look into it :3
[editline]20th February 2015[/editline]
Uhm, is there a special check to make the active tab have a different color? I dont think dozens of elseifs would work :x
I imagine you're looking for something like this, OP?
There's not a great deal of documentation available on things like this, but like zerf said you can always look at the source for some help.
[CODE]for k, v in pairs(PropertySheet.Items) do
if (!v.Tab) then continue end
v.Tab.Paint = function(self,w,h)
draw.RoundedBox(0, 0, 0, w, h, Color(math.random(0,255),0,0))
if v.Tab:IsDown() then
draw.RoundedBox( 0, 2, 2, w - 4, h - 4, Color( 0, 0, 0, 100 ) )
end
end
end[/CODE]
not working :x it goes through like a slot machine, and makes the game lag, and sometimes it gives a error to close an unexisting ( with a ")" at a not existing line.
Sorry, you need to Log In to post a reply to this thread.