Task list made simpler

This commit is contained in:
Cooldude2606
2019-05-30 18:22:33 +01:00
parent 3443943b90
commit d2be730b7a

View File

@@ -183,14 +183,8 @@ function generate_task(player,element,task_id)
local task_area = element[task_id] local task_area = element[task_id]
if not task_area then if not task_area then
-- label to show the task number -- label to show the task number
local top_align = element.add{ element.add{
name='count-'..task_id, name='count-'..task_id,
type='flow'
}
top_align.style.vertical_align = 'top'
top_align.style.vertically_stretchable = true
top_align.add{
name='label',
type='label', type='label',
caption=task_number..')' caption=task_number..')'
} }
@@ -202,14 +196,11 @@ function generate_task(player,element,task_id)
type='flow', type='flow',
} }
Gui.set_padding(task_area) Gui.set_padding(task_area)
task_area.style.vertical_align = 'top'
-- if the player can edit then it adds the edit and delete button -- if the player can edit then it adds the edit and delete button
if player_allowed_edit(player) then if player_allowed_edit(player) then
local flow = Gui.create_right_align(element,'edit-'..task_id) local flow = Gui.create_right_align(element,'edit-'..task_id)
flow.caption = task_id flow.caption = task_id
flow.style.vertical_align = 'top'
flow.style.vertically_stretchable = true
edit_task(flow) edit_task(flow)
discard_task(flow) discard_task(flow)
@@ -218,7 +209,7 @@ function generate_task(player,element,task_id)
end end
-- update the number indexes and the current editing players -- update the number indexes and the current editing players
element['count-'..task_id].label.caption = task_number..')' element['count-'..task_id].caption = task_number..')'
if element['edit-'..task_id] then if element['edit-'..task_id] then
local players = table_keys(details.editing) local players = table_keys(details.editing)
if #players > 0 then if #players > 0 then
@@ -357,7 +348,8 @@ local function generate_container(player,element)
name='table', name='table',
type='table', type='table',
column_count=col_count, column_count=col_count,
draw_horizontal_lines=true draw_horizontal_lines=true,
vertical_centering=false
} }
Gui.set_padding(flow_table) Gui.set_padding(flow_table)
flow_table.style.horizontally_stretchable = true flow_table.style.horizontally_stretchable = true