| View previous topic :: View next topic |
| Author |
Message |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Mon Oct 19, 2020 7:41 am Post subject: ImageList on Listview |
|
|
I am trying add some icons in a list view, using image list. But the icons not show, as similar if use in Laz FP. Any proper example for CE Lua?.
| Code: | if f then f.destroy() end
f = createForm()
f.setSize(600,400)
f.Position = 'poScreenCenter'
f.Caption = 'Test Image On Listview'
ImageList1 = createImageList(f)
ImageList1.DrawingStyle = 'dsNormal'
ImageList1.AllocBy = 4
ImageList1.Hight = 32
ImageList1.Width = 32
ImageList1.ImageType = 'itImage'
ImageList1.Add('D:\\il1.png',1)
ImageList1.Add('D:\\il2.png',2)
ImageList1.Add('D:\\il3.png',3)
ImageList1.Add('D:\\il4.png',4)
ListView1 = createListView(f)
ListView1.setSize(580,300)
ListView1.setPosition(10,10)
ListView1.AutoSort = true
ListView1.ViewStyle = 'vsIcon'
ListView1.LargeImages = ImageList1
ListView1.LargeImages.AllocBy = 4
ListView1.LargeImages.Width = 32
ListView1.LargeImages.Height = 32
for i = 1, 4 do
lv = ListView1.Items.Add()
lv.Caption = 'Item'..i
lv.ImageIndex = i
end
|
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25836 Location: The netherlands
|
Posted: Mon Oct 19, 2020 2:30 pm Post subject: |
|
|
imagelist.add needs a bitmap object, not a string
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Mon Oct 19, 2020 6:42 pm Post subject: |
|
|
DB, I have changed the script.
| Code: | if f then f.destroy() end
f = createForm()
f.setSize(600,400)
f.Position = 'poScreenCenter'
f.Caption = 'Test Image On Listview'
ImageList1 = createImageList(f)
ImageList1.DrawingStyle = 'dsNormal'
ImageList1.Hight = 32
ImageList1.Width = 32
ImageList1.ImageType = 'itImage'
local srcbmp
p = createPicture()
for i = 1, 4 do
local imgfile = 'il'..i..'.png'
p.loadFromStream(findTableFile(imgfile).Stream)
srcbmp = p.getBitmap()
ImageList1.Add(srcbmp, nil)
end
p.Destroy()
ListView1 = createListView(f)
ListView1.setSize(580,300)
ListView1.setPosition(10,10)
ListView1.AutoSort = true
ListView1.ViewStyle = 'vsIcon'
ListView1.StateImages = ImageList1
for i = 1, 4 do
lv = ListView1.Items.Add()
lv.Caption = 'Item'..i
lv.ImageIndex = i
end |
Result (attached):
1. Icon / images show in list view, if list view set 'ListView1.StateImages = ImageList1 '
2. Problem : The icon image shown image from ImageList1 first index for all items in ListView1. Why?
How to correcting No.2 ?
| Description: |
|
| Filesize: |
62.87 KB |
| Viewed: |
2385 Time(s) |

|
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25836 Location: The netherlands
|
Posted: Mon Oct 19, 2020 11:33 pm Post subject: |
|
|
Have you tried the SmallImages imagelist property?
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Mon Oct 19, 2020 11:58 pm Post subject: |
|
|
Yes, I did :
case 1:
---------
listView1.LargeImages = ImageList1 --- icon not show
listView1.SmallImages = ImageList1 --- icon not show
listView1.StateImages = ImageList1 --- icon SHOW but only first index for all items
Combining that 3 options, icon show as long as 'StateImages = ImageList1' defined.
case 2:
---------
Also I try add image to ImageList1 one and also add items to ListView1 one by without loop (for ...do), the result is same
case 3:
--------
Tried creating 3 ImageList (ImageList1, 2, and 3)
Then add only 1 image to each ImageList
Next set the listview refer to each ImageList.
Result : Icon show as image from 'il3.png' for all listview items.
I did check ImageList contains image by:
| Code: | cnt = ImageList.Count
print(cnt) --- result is 4, but I don't know if the 4 images is same or not
|
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25836 Location: The netherlands
|
Posted: Wed Oct 21, 2020 5:05 am Post subject: |
|
|
Looks like ImageIndex and StateIndex are not exported to lua. I'll add them
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Wed Oct 21, 2020 6:08 am Post subject: |
|
|
Oh, okay DB, We will wait for new CE release. Thank you
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25836 Location: The netherlands
|
Posted: Wed Oct 21, 2020 6:30 am Post subject: |
|
|
that will be soon, so if you have any last minute suggestions/requests to add better do so now
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Wed Oct 21, 2020 8:59 am Post subject: |
|
|
Nice DB, I think I just one problem, in CE 6.4 / 6.5.1 to call an library we able using 'require' or 'dofile', but since version 7 and later that not possible and using 'package.loadlib' sometime return package not found.
I thought this is about Lua wrapper / C wrapper and/or package cpath setting.
I hope we have chances to easy call or load a library like in CE 6.4
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25836 Location: The netherlands
|
Posted: Wed Oct 21, 2020 10:26 am Post subject: |
|
|
require and dofile still work
Just make sure that if dlls are used, they get moved to clibs32 or clibs64
Also, the dll files must be made to compile for lua53-64/32.dll , so no static linking to lua53.dll (and certainly not lua51.dll)
Look at savesession.lua in autorun. it require's lfs
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Wed Oct 21, 2020 9:26 pm Post subject: |
|
|
| Dark Byte wrote: | require and dofile still work
Just make sure that if dlls are used, they get moved to clibs32 or clibs64
Also, the dll files must be made to compile for lua53-64/32.dll , so no static linking to lua53.dll (and certainly not lua51.dll)
Look at savesession.lua in autorun. it require's lfs |
Ok, I see and noted this. Thanks
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
|