Panel Not Painting

[LUA]
local PANEL = {}

function PANEL:Init()
Msg(“Please Create Me :3”)

/*
	Size / Positioning
*/
self.iTall = 50;
self.iWide = 200;
self.iShadeHeight = 15;
self.WidthOffSet = 2;
self.HeightOffSet = 2;
self.XOffSet = 1;
self.YOffSet = 1;

/*
	Cosmetics
*/
self.BackgroundColor = Color(220,220,220,255);
self.Color = Color(53,71,242,255);
self.ShadeColor = Color(53,71,242,220);

end

function PANEL:Paint()
Msg("Paint ME :3
");
// Button Outline
surface.DrawOutlinedRect( 0 , 0 , self.iTall , self.iWide , Color( 0 , 0 , 0 , 255 ) );
// Button Base Background
surface.DrawRect( 0 + self.XOffSet, 0 + self.YOffSet, self.iWide - self.WidthOffSet , self.iTall - self.HeightOffSet, self.BackgroundColor );
// Button Main Color
surface.DrawRect( 0 + self.XOffSet, 0 + self.YOffSet + self.iShadeHeight, self.iWide - self.WidthOffSet, self.iTall - self.iShadeHeight - self.HeightOffSet, self.Color);
// Button Shade Color
surface.DrawRect( 0 + self.XOffSet, 0 + self.YOffset, self.iWide - self.WidthOffSet, self.iTall - self.HeightOffSet, self.ShadeColor);
end

function PANEL:PerformLayout()

self:SetSize(iWide, iTall);
self:SetPos(ScrW() / 2,ScrH() / 2);
Msg("I'm Performing a Layout!")

end

vgui.Register(“NavigationButton”, PANEL, “Panel”)
[/LUA]

For some reason, it performs the layout (concluded using the debug msg), but it doesn’t paint? I did make sure it is visible too. Any Ideas? I’m turrible with clientside.

[lua]vgui.Register(“NavigationButton”, PANEL, “Panel”)[/lua]

I’ve never seen a “Panel” before, Whats it look like?

Lol try
[lua]vgui.Register(“NavigationButton”, PANEL, “DPanel”)[/lua]
And post if its still broke.

a Panel is the parent to DPanel. It’s not derma, it’s what the source engine uses for its HUD and menus.

Lol cool, Didnt know about that. Thanks

Plus I fixed your code
[lua]local PANEL = {}

function PANEL:Init()
Msg(“Please Create Me :3”)

/*
	Size / Positioning
*/
self.iTall = 50;
self.iWide = 200;

end

function PANEL:Paint()
Msg("Paint ME :3
");

// Button Outline
surface.SetDrawColor( 0, 0, 0, 255 )
surface.DrawOutlinedRect( 0, 0, self.iTall, self.iWide );
// Button Base Background
surface.SetDrawColor( 220, 220, 220, 255 )
surface.DrawRect( 0, 1,  1, self.iWide - 2, self.iTall - 2 );
// Button Main Color
surface.SetDrawColor( 53, 71, 242, 255 )
surface.DrawRect( 1, 16, self.iWide - 2, self.iTall - 17 );
// Button Shade Color
surface.SetDrawColor( 53, 71, 242, 220 )
surface.DrawRect( 1, 1, self.iWide - 2, self.iTall - 2 );

end

function PANEL:PerformLayout()

self:SetSize(self.iWide, self.iTall);
self:SetPos(ScrW() / 2,ScrH() / 2);
Msg("I'm Performing a Layout!")

end

vgui.Register(“NavigationButton”, PANEL, “Panel”)[/lua]

First problem was the suface.DrawRect, You were trying to add a color to it.

Second problem was the self:SetSize
You were calling it like
[lua]self:SetSize(iWide, iTall);[/lua]
It should have been
[lua]self:SetSize(self.iWide, self.iTall);[/lua]

And your doing
[lua]surface.DrawOutlinedRect( 0, 0, self.iTall, self.iWide );[/lua]
Whats wrong with that? Well your setting the width to the iTall and the height to the iWide…Still dont know the problem? Its gonna cause sizing issues
I didnt fix this because I did not spot it till after I posted this, So
[lua]surface.DrawOutlinedRect( 0, 0, self.iWide, self.iTall );[/lua]

Dunno why you did it this way, Theres a few easier ways to accomplish what you wanted :stuck_out_tongue:

Wow, that’s pretty depressing about how many mistakes I had in my coding lol. Thanks I’ll see if these fixes help!