How to center button in GUI frame?

Place to get help with not working mods / modding interface.
User avatar
Versepelles
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat May 28, 2016 1:42 pm
Contact:

How to center button in GUI frame?

Post by Versepelles »

How can I center the "Launch" button horizontally? (See attached image.) The button is added to a frame with direction = "vertical", but I've tried adding it to flows with both directions to no avail. I think the answer lies in the flow style, but align = "center" didn't do anything.
Attachments
launch button help.jpg
launch button help.jpg (1.12 MiB) Viewed 1771 times
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: How to center button in GUI frame?

Post by aubergine18 »

could you use a table?

Code: Select all

The following kinds of GUI elements are supported:

"button": Clickable elements that fire on_gui_click when clicked.
"sprite-button": A button that displays an image rather than text.
"checkbox": Clickable elements with a cross in the mdidle that can be turned off or on. They also fire on_gui_click when clicked.
"flow": Invisible containers that lay out children either horizontally or vertically. All three root GUI elements (top, left and center; see LuaGui) are flows.
"frame": Grey semi-transparent boxes that contain other elements. They have a caption, and, just like flows, they lay out children either horizontally or vertically.
"label": A piece of text.
"progressbar": Indicate progress by displaying a partially filled bar.
"table": An invisible container that lays out children in a specific number of columns. Column width is given by the largest element contained in that row.
"textfield": Boxes of text the user can type in.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
Versepelles
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat May 28, 2016 1:42 pm
Contact:

Re: How to center button in GUI frame?

Post by Versepelles »

[quote="aubergine18"]could you use a table?

Code: Select all

The following kinds of GUI elements are supported:
[/quote]

I tried this a couple different ways, but to no avail (it can be faked with hard spacers, but I'd rather not do that). align="center" in the table style did nothing, unless I did something wrong. Do you have an example of a centered table?
User avatar
DedlySpyder
Filter Inserter
Filter Inserter
Posts: 254
Joined: Fri Jun 20, 2014 11:42 am
Contact:

Re: How to center button in GUI frame?

Post by DedlySpyder »

I could never get automatic centering to work myself. I normally just add padding/margins to make it look nice
Post Reply

Return to “Modding help”