Best way to add text to a vgui/derma panel

Hey Guys,

What would be the best way to add text to a vgui/derma panel?

thx

brad

[editline]06:28AM[/editline]

help!

  • Bump -

Help!

I think Panel.Paint would be a good way.

for text?

Yes, look at the example on the page.

function Frame4:Paint()
draw.SimpleText(“Hello!”,“DefaultSmall”,5,10,Color(0,0,0,255))
end That’s the example.
it fails because it removes the actual things behind it…

[editline]03:20AM[/editline]

Dont worry.
used function PANEL:PaintOver()
draw.SimpleText(“Hello!”,“DefaultSmall”,0,0,Color(0,0,0,255))
end

[editline]03:20AM[/editline]

Also what is the size list can i find that anywhere because it has DefaultSmall?

Use a DLabel. The Panel.Paint is used to paint your own custom things onto a panel separately. Only use Panel.Paint/Over to do your own art work on the panel, as in a temporary custom skin. Don’t use it/rely on it for things like labels etc, it will only make your code messy and harder to debug if some thing goes wrong.

How to set the colour?

If you go 14 lines down, or 2 up, where it has a list of all the methods you can call on the DLabel object, the link i specified in an earlier post stating you should use that instead, you will see a method called SetTextColour. When you click it it takes you to a page which gives you a very simple example of how to set the texts colour to white.

May I interest you in read the Color page?

You should really read the whole page, from top to bottom and try it out yourself before posting.

wiki.garrysmod.com Always have that open in your browser. And always search that first. This question is a no-brainer. And you’re not specifying what you want to color. Just read the wiki.

With DComboBox
can i make it so when you click a item it adds buttons?

myLabel:SetText( “Dealer: Yes, but i only sell them in pack’s of 10” )
ok
it is only saying Dealer: Yes, but i only sell them in…
Why is it doing…!
help!

[editline]08:56AM[/editline]

myLabel:SizeToContents()

Ok i need help now

Help Guys please!
i need suggestions on how 2 make my gunshop vgui
i made the dealer
i need it
PIC|NAME|PRICE|BUY BUTTON
Any ideas on how 2 do it?

Have you tried using 3 DLabels and a DButton?

Hmmm…
Maybe that means i need to do it for all of em!

[editline]10:48AM[/editline]

Is there a way i can make it do a list?
like on other Peoples roleplay?

[editline]11:09AM[/editline]

Would there be any eaiser way?