SizeToContent and ColorTo Help

Hello,

Why is it when I do the following it does not size the DLabel to the content?
All I get is The first letter followed by … on the screen



    local topMessageText = vgui.Create("DLabel")
    topMessageText:SizeToContents()
    topMessageText:SetPos( 0, (ScrH()/4) )
    topMessageText:SetTextColor( Color( 255, 255, 255, 255 ) )
    topMessageText:MakePopup()
    topMessageText:SetFont("topMessageText")
    topMessageText:SetText( "This is test text" )
    topMessageText:MoveTo( ScrW()/2, (ScrH()/4), 0.1, 15, 1 )
    topMessageText:ColorTo( Color( 255,255,255,0 ), 20, 3)


Also, when I use ColorTo, my text does fade, but it’s grey from the beginning instead of white as said in SetTextColor?

Finally… is there an easy way to get when the player has actually spawned properly and not just ‘sending client info’? I’m showing a message on spawn that will start an animation and then fade out, but feel as though just setting a delay might make it so platyers who take a while to log-in do not see it.

Thanks for the help,

Daniel

SizeToContents should be called after any of the following but not before. When you set/change the objects size or when you set/change the objects text or when you set/change the objects font.

Awesome, Thanks that helped a lot. Finally then, is it possible to get the size that has been set by SizeToContents?

[editline]24th May 2014[/editline]

Found it :wink:



local topMessageTextX, topMessageTextY = topMessageText:GetSize( )