Page 1 of 1

Left Align Button Text?

Posted: Tue Oct 10, 2006 19:53
by arkos
Hey guys,

I am trying to left align the text on a bunch of buttons. I found the function setTextXOffset() but it doesn't seem to do squat.

Also when I call this function is it supposed to kill the centered alignment and make it left aligned with the offset or is the offset taken from the center?

Why doesn't it do anything?



Please let me know.

Code: Select all

((CEGUI::PushButton*)getWindow("facility_btn12"))->setsetTextXOffset(5.5);


Note that I shifted the text an extreme 5.5 and it has no effect. I am using windows look if it matters

Posted: Thu Oct 12, 2006 15:41
by Pompei2
For the StaticTexts, there is the property named "HorzFormatting" with and an enum with the same name IIRC where you can choose the alignment. Maybe there is the same in the PushButtons, I don't know, but you should look for this.

Posted: Fri Oct 13, 2006 17:07
by arkos
Hey pompei2,

thanks for the reply. I know about the StaticText alignment and I often use the HorzFormatting to center the text from the default left alignment. Unfortunately, push button doesn't seem to have anything like this.

The offset X looks like it has promise, but doesn't seem to work as advertised.

Posted: Sat Oct 14, 2006 19:20
by lindquist
You can add this functionality yourself by modifying the pushbutton looknfeel

Posted: Sun Oct 15, 2006 20:37
by arkos
hey lindquist,

thanks for the reply. That looks like it would solve the problem, however, that would alter ALL of the buttons rather than a select few.

To work around this I am assuming I would have to define a look and feel of a special "L_button" which would be the same as the regular button except for the vert alignment. Then I would change the look n feel in the layout editor as well, so that I could create the left aligned buttons there. Is this what you were thinking?