Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Wed Apr 03, 2019 12:07 am Post subject: ListView and Table |
|
|
Hi there,
say I have a CEListView with 3 Columns:
To add an item to CEListView:
Code: | function addHackItem(sender, listitem)
-- hack_table = {}
game_name = edtGame.Text
url_name = urlGame.Text
last_update = os.date("%d.%m.%Y")
local list = plist
local items = list.Items
local item = items.Add()
item.Caption = game_name
item.SubItems.text = url_name.."\n"..tostring(last_update)
end
|
Next, I have a table, said as hack_table.
Now need samples for:
1. How to save or add an item or all items to my table from ListView item(s) with the following format: {game_name,url_name,last_update} ?
2. Say my table contains some fields with items: {game_name,url_name,last_update},{game_name,url_name,last_update} and so on then how add that to my list view?. Note : Table were saved on local disk with name : blablabla.lua
3. Event handler: when double click an item on listview (selected index), how to get only url_name as a variable?
Thanks
EDIT #1 :
1. Add item to the table directly from variables [SOLVED]:
Code: | hack_table = {}
table.insert(hack_table,{name =game_name, url = url_name, ls_update = last_update"})
table.sort(hack_table, function(x,y) return x.name < y.name end)
for _,hack_table in ipairs(hack_table) do print(hack_table.name, hack_table.url, hack_table.ls_update) end
|
EDIT #2 :
3. Event handler: when double click an item on listview (selected index), how to get only url_name as a variable?
with this code :
Code: | game = list.Items[list.ItemIndex+1].Caption
url = list.Items[list.ItemIndex+1].SubItems[0]
lsupdate =l ist.Items[list.ItemIndex+1].SubItems[1]
print(game..','..url..','..lsupdate)
table.insert(hack_table,{game_name = game, ur_namel = url, last_update = lsupdate})
|
So, with the code above, I am able to handle all variables/elements that I need. Case closed.
Anyhow, thanks for attention if any.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|