Fill accomlistbox
Example
<source lang="lua"> -- a simple accomplishment list with static data -- TODO: figure out how to get rid of the white boxes
-- build item list local items = {} -- title item table.insert(items, {title="test"}) -- accomplishment items -- index is an accomplishment index table.insert(items, {index=1}) table.insert(items, {index=2}) table.insert(items, {index=3})
table.insert(items, {title="test2"}) table.insert(items, {index=4}) table.insert(items, {index=5})
local c = iup.itemlisttemplate{control="yes", size="400x300"} local d = iup.dialog{c, topmost="yes"}
-- function called for each row local function setup_cb(index, itemlist, subdlg) local item = itemlist[index]
-- item is category item -- there can only be one per row -- add it and return incremented index if item.title then subdlg:SetTitle(item.title) return index + 1 end
-- add icons till the row is filled, end of itemlist -- is reached or the item is a new category for i=1,MAX_ACCOMICON2_COLUMNS do if index > #itemlist then break end
local item = itemlist[index] if item.title then -- got next category return index else -- add an icon subdlg:SetIcon(i, "images/icon_addon_empty.png", "0 0 1 1", "32x32", nil, "Accomplishment "..tostring(item.index)) end index = index + 1 end -- return new index return index end
d:show()
-- fill the list fill_accomlistbox(c, items, setup_cb) </source>