Page 1 of 1

How to change the distance between gui elements

Posted: Mon Nov 19, 2018 4:29 pm
by WIZ4
How to change the distance between gui elements. I want to shorten the distance to 0.
Screenshot_1.jpg
Screenshot_1.jpg (106.47 KiB) Viewed 2567 times

Re: How to change the distance between gui elements

Posted: Mon Nov 19, 2018 9:28 pm
by eradicator
You have to change the padding via directly editing the style at runtime (https://lua-api.factorio.com/latest/LuaStyle.html) or defining a custom style in data stage.

Re: How to change the distance between gui elements

Posted: Sat Feb 23, 2019 7:47 pm
by apriori
Tried to set guielement.style.xxx_padding = 0 but didn't help, I'm still having distance between elements:
2019-02-23_22-49-31.png
2019-02-23_22-49-31.png (45.65 KiB) Viewed 2449 times
But earlier the same code worked just fine:
2019-02-23_22-52-07.png
2019-02-23_22-52-07.png (23.11 KiB) Viewed 2449 times
EDIT: I add buttons to a flow. Tried to set paddings of both a flow and buttons, but it didn't work.
EDIT: Where can I find ALL properties for EVERY SINGLE style? Looks like I miss some... Didn't find on Wiki and in APIdocs.

Re: How to change the distance between gui elements

Posted: Sun Feb 24, 2019 12:42 pm
by WIZ4
apriori wrote:
Sat Feb 23, 2019 7:47 pm
Tried to set guielement.style.xxx_padding = 0 but didn't help, I'm still having distance between elements:
2019-02-23_22-49-31.png

But earlier the same code worked just fine:
2019-02-23_22-52-07.png

EDIT: I add buttons to a flow. Tried to set paddings of both a flow and buttons, but it didn't work.
EDIT: Where can I find ALL properties for EVERY SINGLE style? Looks like I miss some... Didn't find on Wiki and in APIdocs.
I solved the problem by adding buttons to the table. And changing the vertical_spacing and horizontal_spacing to 0
Screenshot_5.jpg
Screenshot_5.jpg (10.34 KiB) Viewed 2425 times
But I still hope that in 0.17 it can be made easier.

Re: How to change the distance between gui elements

Posted: Sun Feb 24, 2019 1:22 pm
by apriori
WIZ4 wrote:
Sun Feb 24, 2019 12:42 pm
I solved the problem by adding buttons to the table. And changing the vertical_spacing and horizontal_spacing to 0

But I still hope that in 0.17 it can be made easier.
Yep, I wanted to do the same, but right now found another solution making me able to use flows and frames instead of tables:

styles.lua:

Code: Select all

data.raw["gui-style"].default["teleportation_thin_flow_hor"] = {
  type = "horizontal_flow_style",
  horizontal_spacing = 0,
  resize_row_to_width = true
}
data.raw["gui-style"].default["teleportation_thin_flow_ver"] = {
  type = "vertical_flow_style",
  vertical_spacing = 0,
  resize_row_to_height = true
}
It makes flows remove any gap in a row/column. It's strange I can't use the same in runtime:

Code: Select all

flowElement.style.horizontal_spacing = 0
...this code leads to a crash because the game lets use horizontal_spacing in runtime only for a table, not for a flow. I'm sure it's a dev's mistake, but it is and I have to work with it.
2019-02-24_16-31-53.png
2019-02-24_16-31-53.png (50.84 KiB) Viewed 2415 times

Re: How to change the distance between gui elements

Posted: Sun Feb 24, 2019 1:27 pm
by Klonan
apriori wrote:
Sun Feb 24, 2019 1:22 pm
I'm sure it's a dev's mistake, but it is and I have to work with it.
We have fixed it for 0.17

Re: How to change the distance between gui elements

Posted: Sun Feb 24, 2019 2:02 pm
by apriori
Klonan wrote:
Sun Feb 24, 2019 1:27 pm
We have fixed it for 0.17
Klonan, hello! Where can I find ALL properties for EVERY SINGLE style? Didn't find on Wiki and in APIdocs.

Re: How to change the distance between gui elements

Posted: Mon Feb 25, 2019 8:01 am
by darkfrei
apriori wrote:
Sun Feb 24, 2019 2:02 pm
Klonan, hello! Where can I find ALL properties for EVERY SINGLE style? Didn't find on Wiki and in APIdocs.
I have no idea where it was documented, but all this stuff you can find with viewtopic.php?f=135&t=45107