[bug?] luaguielement textfield and style.horizontal_align

Place to get help with not working mods / modding interface.
Post Reply
adamius
Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Mon Mar 19, 2018 9:18 am
Contact:

[bug?] luaguielement textfield and style.horizontal_align

Post by adamius »

My test code shows that textfield ignores style.horizontal_align.

Is this correct / expected behavior?
Last edited by adamius on Mon Jun 24, 2019 2:31 pm, edited 1 time in total.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: luaguielement textfield and style.horizontal_align

Post by Choumiko »

Works for me:

Code: Select all

style.horizontal_align = "center"
Screenshot from 2019-05-21 11-00-27.png
Screenshot from 2019-05-21 11-00-27.png (3.05 KiB) Viewed 930 times
Did you assign anything invalid?

adamius
Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Mon Mar 19, 2018 9:18 am
Contact:

Re: luaguielement textfield and style.horizontal_align

Post by adamius »

Try aligning it left. Make the amount of text longer than what fits.

Different examples:

/c local t = game.players[1].gui.left.add{name="sometextfield",text="L12345678901234567890C123456789012344567890R",type="textfield"} ; t.style.horizontal_align="left"; t.style.width=1000

/c local t = game.players[1].gui.left.add{name="somebutton",caption="L12345678901234567890C123456789012344567890R",type="button"} ; t.style.horizontal_align="left"; t.style.width=1000

horizontal_align works fine on buttons but not textfields.

Post Reply

Return to “Modding help”