ListBox RowTag Purpose and Use

Hello, all!

I use the ListBox often enough, but I have not needed the RowTag or something like it until recently. I confess I don't know exactly what it is and what it is used for. Can someone enlighten me? I haven't found documentation about it.

An example also would be helpful.

Many thanks.

Many of times you will find the need for each listbox row to have the ability to get its own class data for itself by way of storing its class data in either its (that specific row) rowtag or celltag. When you get into hierarchical list boxes you will use it then. The rowtag and cell tags are variants so you can store really anything in them. I’m sure others will add to this also :slight_smile:

Really useful. Because they’re variants, you can put anything in them. In one program I use the RowTag to store the background color of the row, and I use a CellTag to store a unique ID for the row’s data source.

One example would be to store the row’s database identifier in the rowtag. That allows you to query the database for additional information regarding that row.

Another use would be to create a class which has properties for all the database fields associated with the row. Some of those fields will be displayed in the listbox, the rest are held at the ready in the rowtag for immediate access in that row.

Basically, it’s for whatever you want to use it for.

You can store Photo data in the ListBox and store its FolderItem in the row tag who will be used to display the image.

Many examples…

References (API2):

Thanks, all!

From your responses, I made my own RowTag after a fashion in the good old days of REALbasic 5.5. I created a class called CellData consisting of multiple properties, fill in the properties with the values needed for the particular operation, and store the CellData in Cell(row, column).CellTag. (Remember in RB 5.5 and earlier, the ListBox did not have a RowTag property, but it did have a CellTag one. Other classes did, but the ListBox did not.)

A bit of overkill, perhaps, but you do what you can with the tools you have.

Thanks again, all!