I am trying to place multiple UI elements within a flow. A label, textfield, check-box and sprite button. The situation looks like this:
The "refresh" button is supposed to be on the right side. Changing .style.align of the outer flow moves all elements to the right. Since there is no spacing parameter, do I have to add an invisible item between checkbox and button, or is there a better way?
Shifting LuaGuiElements
Re: Shifting LuaGuiElements
The way we do it, even internally, is to add a horizontal flow between the widgets and set `flow.style.horizontally_stretchable = true`eduran wrote: Fri Feb 01, 2019 1:40 pm I am trying to place multiple UI elements within a flow. A label, textfield, check-box and sprite button. The situation looks like this:
The "refresh" button is supposed to be on the right side. Changing .style.align of the outer flow moves all elements to the right. Since there is no spacing parameter, do I have to add an invisible item between checkbox and button, or is there a better way?
Re: Shifting LuaGuiElements
Thank you for the quick reply. A follow-up question: Is it possible to place an element next to a frame title, e.g. in the top right corner of the following image:
Re: Shifting LuaGuiElements
No, frames are hardcoded in that way...eduran wrote: Fri Feb 01, 2019 2:33 pm Thank you for the quick reply. A follow-up question: Is it possible to place an element next to a frame title, e.g. in the top right corner of the following image:
frame.JPG
Re: Shifting LuaGuiElements
I assume you want to put an exit-button in the top right corner. Well you can get around the frame issue, by simply not settings a title, and doing it yourself, like this:
... adding styling and such, of course.
Code: Select all
local main_dialog = player.gui.center.add{type="frame", name="main_dialog", direction="vertical"}
local titlebar = main_dialog.add{type="flow", name="flow_titlebar", direction="horizontal"}
titlebar.add{type="label", name="label_titlebar_name", caption="Title"}
titlebar.add{type="flow", name="flow_titlebar_spacing", direction="horizontal"}
titlebar["flow_titlebar_spacing"].style.horizontally_stretchable = true
titlebar.add{type="button", name="button_titlebar_exit", caption="X"}
