Listbox and Cellbackgroundpaint

Hi my first post.
I have done plenty of visual basic programming but i am new to Xojo
I am building an application using a listbox with 3 columns and loading data from a sqlight database. Each record in the database (only 8 records at the moment) has a blob item which i wish to put in the first column of the list.
I can make it work using RowImageAt but as others have pointed out the image is cliped on the left hand side. I am now trying to use the CellBackgroungPaint event. I have added the event to the listbox and added the following code in the event.

Var rows As RowSet
rows = Hobby.SelectSQL(“SELECT * FROM Hobby1;”)
End Try

Var Mydata As Picture

For row = 0 To 4
Mydata = rows.Column(“Icon”).PictureValue

If column = 0 Then
End If

Return True
This fills the first column with copies of the blob in the 4th record.
Can somebody show me where i am going wrong.
Thanks David

The CellBackgroundPaint Event is raised for each cell that is drawn. You don’t need to cycle through the list to draw your data, you would check the column/row to see if it’s the appropriate cell to draw your picture.

You can store the picture data in the CellTag when you load the data into the Listbox.

1 Like

Thanks for the pointers. Yes I was using CellBackgroudPaint incorrectly.
All working well now, better than RowImageAt.
CellTag seems to have been replaced with CellTagAt