Recent

Author Topic: Problem with imagelist in lamw  (Read 664 times)

Narciso

  • New Member
  • *
  • Posts: 10
Problem with imagelist in lamw
« on: February 20, 2025, 04:34:08 pm »
Why if i put 2 imagelist in a android module, from Android Bridges, the second copy the first like if them were the same component, and why if i modify one of them it modify also the other?
Thank You!

c4p

  • Full Member
  • ***
  • Posts: 170
Re: Problem with imagelist in lamw
« Reply #1 on: February 20, 2025, 08:15:35 pm »
I believe this is a known issue.

See:
https://forum.lazarus.freepascal.org/index.php/topic,55330.msg411470.html#msg411470

@dseligo did you find a resoution?
Lazarus 2.0.12 r64642/FPC 3.2.0 LAMW v0.8.6.4 on Windows 10+Linux Mint 21.2, projects mainly built using AppCompat and Gradle.

c4p

  • Full Member
  • ***
  • Posts: 170
Re: Problem with imagelist in lamw
« Reply #2 on: February 21, 2025, 07:46:02 pm »
A possible workaround for you to eliminate using the jImagelist:

Drop the images you require in the assets folder of your project and use the jImageFileManager component instead to reference your images like below, the example below is using the bimap JObject of the jListView component in the OnDrawItemBitmap Event, also see the AppListView demo to load using a Resource:

Code: Pascal  [Select][+][-]
  1. bimap := jImagefilemanager1.LoadFromAssets('yourImage.jpg');

You can, of course, add a folder path before 'yourImage.jpg' like a folder called imgsource below, this will allow you to put them all in a single folder, makes things a bit neater:

Code: Pascal  [Select][+][-]
  1. bimap := jImagefilemanager1.LoadFromAssets('imgsource'+'/'+'yourImage.jpg');

I personally find this easier than having to add images manually to the imagelist, just copy them directly to the assets folder and it's done, then reference it in your code like above, you can index the images uniquely.
Lazarus 2.0.12 r64642/FPC 3.2.0 LAMW v0.8.6.4 on Windows 10+Linux Mint 21.2, projects mainly built using AppCompat and Gradle.

 

TinyPortal © 2005-2018