PolyList and content-type = image-data

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
tomsve
Posts: 46
Joined: Tue Jan 20, 2015 5:01 pm

PolyList and content-type = image-data

Post by tomsve » Tue May 20, 2025 9:19 pm

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!

lcwill
Posts: 4
Joined: Sat Jul 06, 2024 11:50 pm

Re: PolyList and content-type = image-data

Post by lcwill » Tue Jun 03, 2025 1:18 am

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: PolyList and content-type = image-data

Post by bn » Tue Jun 03, 2025 8:19 pm

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

lcwill
Posts: 4
Joined: Sat Jul 06, 2024 11:50 pm

Re: PolyList and content-type = image-data

Post by lcwill » Sat Jun 07, 2025 1:54 am

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

Post Reply