TGUI Forum

General Category => Help requests => Topic started by: starkhorn on 02 October 2015, 02:08:47

Title: v0.7 alphav2 - text position on a button
Post by: starkhorn on 02 October 2015, 02:08:47
Is it possible to set the position of the text on a button? I have the text size small and I wanted it to be in the top left corner of the button.
Title: Re: v0.7 alphav2 - text position on a button
Post by: texus on 02 October 2015, 09:56:32
No, this is not possible with just a Button.

You would have to use a button without text and use a Label which you position like this:
Code: (cpp) [Select]
label->setPosition(tgui::bindPosition(button));
or if you want to fine-tune the distance to the top left corner a bit more:
Code: (cpp) [Select]
label->setPosition(tgui::bindPosition(button) + sf::Vector(4, 2));
Title: Re: v0.7 alphav2 - text position on a button
Post by: starkhorn on 05 October 2015, 05:14:43
awesome - works a treat. Thank you.