My Label instead of DLabel

Hello, I have some serious bugs with this.
Can you see any problem in the code?

Panel = {}

function Panel:Paint()



function Panel:SetText(text)

self.Text = text


function Panel:SetFont(font)

self.Font = font


function Panel:SetPos(x,y)

self.PosX = x
self.PosY = y


function Panel:SetAlign(x,y)

self.Align = x
self.VAlign = y

Text spawning code:
local BName = vgui.Create(“GLabel”,BPanel)

If I turn on SetWidth it works but I have a problem, there should be texts next those icons.
I put them to the top of the panel and they were visible there.
And if I added SetTall() then they were visible from the top until the Tall

Pictures :

It’s not easy to understand what the problem is. Are you saying that when you don’t use SetWidth, some of the text on the topmost label becomes chopped off? I’m guessing from the pictures.

If so, there is a function, SizeToContents which you can use to automatically make the invisible text-drawing area for the label the same size as the text.

The problem is that when I use it on those material texts you see down it doesn’t work because of the tall. It thinks that the text is the whole panel or I don’t know.
I show you pictures
SetTall : 45
SetTall : 65
SetTall : 80

Code :
for k,v in pairs(Types[k].res) do
local BRAmount = vgui.Create(“GLabel”,BPanel)

i = i + 1


By the way, I tried :SizeToContents but it doesn’t work :confused:

You can only use SizeToContents if its derived from DLabel ( I think )

Quoting yourself doesn’t make you any less wrong. In the piece of code in the OP, You aren’t deriving from DLabel , one can then assume that when you said “SizeToContents doesn’t work” , what you actually meant was that the function didn’t exist, and in which case my point stands, you need to derive it from DLabel to work.

Either way you are wrong when you quote yourself in your last post, because it means either you were to arrogant to actually try it, or that you weren’t precise enough in the description of your problem , and in which case it’s not our fault if your problem doesn’t get resolved.