Code: Select all
local char_window = gui.add({
type = "frame",
name = character_frame,
caption = {"minime-GUI.gui-name-charselector-caption"},
direction = "vertical",
visible = true,
})
Code: Select all
for p_index, p in pairs(global.gui_character_pages) do
element = make_table(char_window, p_index)
end
Code: Select all
main_flow = gui.add({
type = "flow",
name = bottom_flow,
direction = "horizontal",
visible = true,
})
Code: Select all
local function make_spacer(parent, name, width)
local ret = parent.add({
type = "empty-widget",
name = name,
direction = "horizontal",
})
ret.style.natural_width = width or 100
ret.style.horizontally_squashable = true
return ret
end
Problem: The width of main_flow should be the same as that of char_window. The width of char_window depends on the width of the visible table inside it. The width of the table depends on the width of the individual columns in that table. In an ideal world, this would be the same as the width of the "camera" elements -- but I can't guarantee that because the buttons below the cameras may be wider (depending on the localized string they display).
I thought that I could just read main_flow.style.width after the flow has been rendered, but that won't work. Also, style.width of the visible table inside character_frame is nil. Is there any way how I could determine the real width of character_frame, so that I can set the width of main_flow?