Unable to remove gap between two buttons in a flow
Posted: Mon Mar 27, 2023 2:32 pm
I am trying to remove the gap between two buttons (more specifically a sprite-button and a button) in a horizontal flow (see attachement). Here is a short snippet that adds a command for creating this GUI:
I tried setting margins on the buttons to 0 and padding on the flow to 0, but this does not seem to have any effect. Am I misinterpreting how margin and padding works or do you have any other suggestion how to get rid of the gap?
Many thanks in advance!
Code: Select all
commands.add_command('debug_gui', '', function(data)
local player = game.get_player(data.player_index)
local frame = player.gui.screen.add {
type = 'frame'
}
frame.force_auto_center()
local flow = frame.add {
type = 'flow',
direction = 'horizontal'
}
flow.style.padding = 0
local button = flow.add {
type = 'sprite-button',
style = 'tool_button',
sprite = 'utility/shuffle'
}
button.style.margin = 0
local list_box_item = flow.add {
type = 'button',
style = 'list_box_item',
caption = 'list box item caption'
}
list_box_item.style.margin = 0
end)
Many thanks in advance!