Page 1 of 1

PolyList and content-type = image-data

Posted: Tue May 20, 2025 9:19 pm
by tomsve
I've been trying to find information on how to use the PolyList and specifically the data type image-data, but I can't find any.

Ideally I'd like to manipulate (rotate) an image before adding it to a specific item in the PolyList.

Just for testing purposes, I've;
- Added an image control, named "imageArrow"
- Selected an image for use in the image control

This is the code I've tested, without success;

Code: Select all

put image "imageArrow" into aData[1]["wind"]
set the dataContent of widget "PolyList" to aData
and

Code: Select all

put the imageData of image "imageArrow" into aData[1]["wind"]
set the dataContent of widget "PolyList" to aData
But none of it works. Any ideas?

Thanks and regards!

Re: PolyList and content-type = image-data

Posted: Tue Jun 03, 2025 1:18 am
by lcwill
The first form should work, make sure your polylist has a sub item with image-data type named "wind"
You can provide a sample stack with the issue if you need further help or PM at me

Image-data type actually accepts the text property content of images

Re: PolyList and content-type = image-data

Posted: Tue Jun 03, 2025 8:19 pm
by bn
Hi Tom,

I am not very familiar with the PolyList widget. But by looking at the examples from the SummerBundle and the dictionary I managed to display an image in widget PolyList.

The trick seems to be that you first have to set the "DataLayout" and then set the dataContent.

Code: Select all

on mouseUp
   -- first make a dataLayout
   put "wind" into tArray[1]["name"]
   put "image-data" into tArray[1]["content-type"]
   put "contain" into tArray[1]["content-fit"]
   
   -- set the dataLayout
   set the dataLayout of widget "PolyList" to tArray
   
   -- now set dataContent
   put image "imageArrow" into aData[1]["wind"]
   set the dataContent of widget "PolyList" to aData
end mouseUp
Please note that what PolyList calls "image-data" is an image imported as control into the stack. In LIvecode proper "imageData" is a different thing.

What it calls "image" seems to be a referenct as path to an image file.

I hope that gives you an idea.

Kind regards
Bernd

Re: PolyList and content-type = image-data

Posted: Sat Jun 07, 2025 1:54 am
by lcwill
In LC image data refers to the pixel data of the image where each pixel is represented by 4 bytes, in the case of the polylist it means the actual data of the image file, equivalent to text property of image controls.
In the case of image-path it refers to a path to a image file, which I recommend to verify file existence before assigning it