Page 1 of 1
How to center button in GUI frame?
Posted: Sun Jul 24, 2016 11:34 am
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.
Re: How to center button in GUI frame?
Posted: Mon Jul 25, 2016 1:50 pm
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.
Re: How to center button in GUI frame?
Posted: Mon Jul 25, 2016 4:15 pm
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?
Re: How to center button in GUI frame?
Posted: Mon Jul 25, 2016 4:49 pm
by DedlySpyder
I could never get automatic centering to work myself. I normally just add padding/margins to make it look nice