[0.17.76] gui table ignores colum count if it has fewer elements than columns

Bugs that are actually features.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

[0.17.76] gui table ignores colum count if it has fewer elements than columns

Post by eradicator »

Example Snippet:

Code: Select all

/c game.player.gui.screen.clear()
--[[a]]
local s = game.player.gui.screen.add{type='frame',caption='3 col, 2 elm'}.add{type='table',column_count=3}
s.style.width = 1000
for i=1,2 do s.add{type='frame',caption='test'} end
--[[b]]
local s = game.player.gui.screen.add{type='frame',caption='2 col, 2 elm'}.add{type='table',column_count=2}
s.style.width = 1000
for i=1,2 do s.add{type='frame',caption='test'} end
--[[c]]
local s = game.player.gui.screen.add{type='frame',caption='3 col, 3 elm'}.add{type='table',column_count=3}
s.style.width = 1000
for i=1,3 do s.add{type='frame',caption='test'} end
Example Picture:
wrongcolcount.png
wrongcolcount.png (82.71 KiB) Viewed 804 times

This breaks formatting for tables with dynamic content:
alignmentfail.png
alignmentfail.png (82.81 KiB) Viewed 804 times
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.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [0.17.76] gui table ignores colum count if it has fewer elements than columns

Post by eradicator »

Yea...as expected. Broken by design. So not a bug *sigh*. Time to start inserting dummy flows...
It was worth a try.
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.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [0.17.76] gui table ignores colum count if it has fewer elements than columns

Post by eradicator »

Move this to modding help if you want, but i don't get it. I tried using a custom style (the element frames are 50*8=400 wide):

Code: Select all

This.styles['er:recipe-finder-item-table'] = {
  type = 'table_style',
  column_widths = { --still needs dummy padding elements and breaks even worth without
    { column = 1, minimal_width = 49*8, maximal_width = 51*8, },
    { column = 2, minimal_width = 49*8, maximal_width = 51*8, },
    { column = 3, minimal_width = 49*8, maximal_width = 51*8, },
    },
  }
But if the table only has two elements it still oversizes column 1+2:
with_only_two_elements.png
with_only_two_elements.png (173.76 KiB) Viewed 772 times

Only if i put in an empty-widget into the third colum does it look (almost) right:
with_empty_widget.png
with_empty_widget.png (96.6 KiB) Viewed 772 times
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.
Post Reply

Return to “Not a bug”