How do I use SetTextAlignment?

Hello, I’m trying to align a Text to the right. Whenever I set:

text->SetTextAlignment(HA_RIGHT);

or

text->SetTextAlignment(HA_CENTER);

It makes the text disappear completely. Is there something simple I’m missing to align the text to the right or center?

try use text->SetSize() first

Thanks 1vanK, it turns out I needed text->SetFixedSize() to get it working properly.