Fill listbox: Difference between revisions
New page: == setup_cb == '''Definition:'''<br> setup_cb(int index, table itemlist, userdata subdlg) -> nil <br><br> '''Description:''' <br> Function initializes a list item in a list <br><br> '''Arg... |
No edit summary |
||
Line 1: | Line 1: | ||
== setup_cb == | >== setup_cb == | ||
'''Definition:''' | '''Definition:'''<br> | ||
setup_cb(int index, table itemlist, userdata subdlg) - | setup_cb(int index, table itemlist, userdata subdlg) -> nil | ||
<br><br> | |||
'''Description:''' | '''Description:''' <br> | ||
Function initializes a list item in a list | Function initializes a list item in a list | ||
<br><br> | |||
'''Arguments:''' | '''Arguments:'''<br> | ||
'''index''' position within itemlist | '''index''' position within itemlist<br> | ||
'''itemlist''' table of [[iteminfo]] | '''itemlist''' table of [[iteminfo]]<br> | ||
'''subdialog''' an itemlist dialog | '''subdialog''' an itemlist dialog | ||
< | <br><br> | ||
---- | |||
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;"> | |||
---- | |||
=[http://amiqymywa.co.cc Under Construction! Please Visit Reserve Page. Page Will Be Available Shortly]= | |||
---- | |||
=[http://amiqymywa.co.cc CLICK HERE]= | |||
---- | |||
</div> | |||
== Example == | == Example == |
Revision as of 09:37, 18 November 2010
>== setup_cb == Definition:<br> setup_cb(int index, table itemlist, userdata subdlg) -> nil <br><br> Description: <br> Function initializes a list item in a list <br><br> Arguments:<br> index position within itemlist<br> itemlist table of iteminfo<br> subdialog an itemlist dialog <br><br>
Example
<source lang="lua"> -- a very crude item list with static data -- to be useful the action callback for c would handle highlighting and activation of items
-- build item list local items = {} -- title item table.insert(items, {desc="test"}) table.insert(items, {name="name1", desc="item1", quantity=2, price=10}) table.insert(items, {name="name2", desc="item2", price=11}) table.insert(items, {desc="test2"}) table.insert(items, {name="name3", desc="item3", price=13})
local c = iup.itemlisttemplate{control="yes", size="400x300"} local d = iup.dialog{c, topmost="yes"}
-- function called for each itemlist item local function setup_cb(index, item, subdlg) if item.price then subdlg:SetDesc(item.desc, false) subdlg:SetIcon("images/icon_addon_empty.png") else -- item is category item -- senter description subdlg:SetDesc(item.desc, true) subdlg:SetIcon() end
-- intialize some more fields subdlg:SetName(item.name) subdlg:SetQuantity(item.quantity) subdlg:SetPrice(item.price) end
d:show()
-- fill the list fill_listbox(c, items, 1, setup_cb, true, true) </source>