Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


ImageList on Listview

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Mon Oct 19, 2020 7:41 am    Post subject: ImageList on Listview Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25836
Location: The netherlands

PostPosted: Mon Oct 19, 2020 2:30 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Mon Oct 19, 2020 6:42 pm    Post subject: Reply with quote

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 ?



Capture.png
 Description:
ListView1 Icon Result
 Filesize:  62.87 KB
 Viewed:  2385 Time(s)

Capture.png



_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25836
Location: The netherlands

PostPosted: Mon Oct 19, 2020 11:33 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Mon Oct 19, 2020 11:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25836
Location: The netherlands

PostPosted: Wed Oct 21, 2020 5:05 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Oct 21, 2020 6:08 am    Post subject: Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25836
Location: The netherlands

PostPosted: Wed Oct 21, 2020 6:30 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Oct 21, 2020 8:59 am    Post subject: Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25836
Location: The netherlands

PostPosted: Wed Oct 21, 2020 10:26 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Oct 21, 2020 9:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites