Images in Data Grids

Peter Haworth pete at
Mon Oct 29 17:36:21 EDT 2012

Hi Ronald,
I think Mark may be able to point you in the right direction better than I
on this since he seems to have at least figured out how to dynamically put
images into the datagrid, not sure about changing the image on the fly.

Here's another approach that might work using a table instead of a datagrid.

Let's say you have two columns in the table, one for the image and another
for the text you want your users to type into, and that somewhere in your
stack you have the images stored away.  When you load data into the table,
put a space into the first column of each line, then:

set the imagesource of char 1 of line x of field "yourtable" to the ID of
image "yourimage"

That will make the image appear in column 1 of your table.  You might also
need to set the textshift property of the char to make the image align
vertically the way you want it.

To detect when the user clicks on the image, put a mouseDown handler in the
table script:

on mouseDown
   *put* the imagesource of char (word 2 of the mouseCharChunk) of me
   switch tImageID
      case <an image ID>
      case <another image ID>
      case <etc>
         <if you get here, they didn't click on an image>
   end switch

If you need to change the imagesource when it's clicked, you can do it in
the case statements plus whatever else needs to happen.

Not sure what data you need to sort on but I'm sure that could be

Hope that helps,

lcSQL Software <>

On Mon, Oct 29, 2012 at 1:41 PM, Ronald Zellner <zellner at> wrote:

> That's correct, I want a different image in each row.
> These will be set at the beginning, but I do want the image source to
> change for each when it is first selected by the user.
> (Controlled by a card script called by the image)
> I thought of simply putting them in a group with a scroll bar, but I
> really need the sorting function so want to use the DataGrid.
> I'm still not clear on the method to place an image in the grid cell in
> the first place.
> Ron
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:

More information about the Use-livecode mailing list