"centerleft" doesnt work for a Button with auto width, workaround?
#1
Hello

What i try to achive is a line underneath a Text with the exact length of the Text. As this seems not possible by default, my idea was to use a button with "auto" width, which holds the same Text as the label. to scale the texture to the exact text length. (which works.)

Now the Problem: I can easely center the text, but struggle to center the Button underneath, (which holds the Texture). my idea was to use <centerleft>50%</centerleft> to position the Button (But this seems to work only with a integer width).

Does may someone have a Idea how to solve this? Dont have to be the "Button aproach", just Looking for a solution to have a Text underlined with the exact label length.

reg.
Reply
#2
Try putting the button inside a horizontal grouplist with <align>center</align>

e.g.
xml:

<control type="grouplist">
<orientation>horizontal</orientation>
<align>center</align>
<control type="button">
<width>auto</width>
</control>
</control>

I'm not 100% sure if it works but from memory I think it might.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#3
Thanks, works!

would (have) be cool if there would be something which work inside of a list, would have reduce the efford! (thers nothing a could think of)
I knew, just use a button inside a list is (already) "evil".

Currently not shure if the effect is worth it to fiddle around thurder with animations to make it look good, so i may leave it "as is".

Thanks for the "Grouplist hint"!

reg.
Reply

Logout Mark Read Team Forum Stats Members Help
"centerleft" doesnt work for a Button with auto width, workaround?0