Fill listbox: Difference between revisions

From Vendetta Lua
Jump to navigationJump to search
Otutytaqo (talk | contribs)
No edit summary
m Reverted edits by Otutytaqo (Talk) to last version by Chefkoch
 
Line 1: Line 1:
>== setup_cb ==
== setup_cb ==
'''Definition:'''<br>
'''Definition:'''<br>
setup_cb(int index, table itemlist, userdata subdlg) -&gt; nil
setup_cb(int index, table itemlist, userdata subdlg) -> nil
&lt;br&gt;&lt;br&gt;
<br><br>
'''Description:''' &lt;br&gt;
'''Description:''' <br>
Function initializes a list item in a list
Function initializes a list item in a list
&lt;br&gt;&lt;br&gt;
<br><br>
'''Arguments:'''&lt;br&gt;
'''Arguments:'''<br>
'''index''' position within itemlist&lt;br&gt;
'''index''' position within itemlist<br>
'''itemlist''' table of [[iteminfo]]&lt;br&gt;
'''itemlist''' table of [[iteminfo]]<br>
'''subdialog''' an itemlist dialog
'''subdialog''' an itemlist dialog
&lt;br&gt;&lt;br&gt;
<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 ==

Latest revision as of 18:54, 20 November 2010

setup_cb

Definition:
setup_cb(int index, table itemlist, userdata subdlg) -> nil

Description:
Function initializes a list item in a list

Arguments:
index position within itemlist
itemlist table of iteminfo
subdialog an itemlist dialog

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>