How to change the distance between gui elements

Place to get help with not working mods / modding interface.
User avatar
WIZ4
Fast Inserter
Fast Inserter
Posts: 209
Joined: Thu Apr 07, 2016 1:36 pm
Contact:

How to change the distance between gui elements

Post 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 2961 times
My native language is russian. Sorry if my messages are difficult to read.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: How to change the distance between gui elements

Post 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.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
apriori
Filter Inserter
Filter Inserter
Posts: 282
Joined: Thu Feb 18, 2016 8:13 pm
Contact:

Re: How to change the distance between gui elements

Post 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 2843 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 2843 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.
Any code or mods posted by me are WTFPL, unless otherwise copyrights are specified.
User avatar
WIZ4
Fast Inserter
Fast Inserter
Posts: 209
Joined: Thu Apr 07, 2016 1:36 pm
Contact:

Re: How to change the distance between gui elements

Post 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 2819 times
But I still hope that in 0.17 it can be made easier.
My native language is russian. Sorry if my messages are difficult to read.
apriori
Filter Inserter
Filter Inserter
Posts: 282
Joined: Thu Feb 18, 2016 8:13 pm
Contact:

Re: How to change the distance between gui elements

Post 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 2809 times
Last edited by apriori on Sun Feb 24, 2019 1:27 pm, edited 1 time in total.
Any code or mods posted by me are WTFPL, unless otherwise copyrights are specified.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5304
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: How to change the distance between gui elements

Post 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
apriori
Filter Inserter
Filter Inserter
Posts: 282
Joined: Thu Feb 18, 2016 8:13 pm
Contact:

Re: How to change the distance between gui elements

Post 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.
Any code or mods posted by me are WTFPL, unless otherwise copyrights are specified.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: How to change the distance between gui elements

Post 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
Post Reply

Return to “Modding help”