How to subclass a listbox *cell*?

I’m playing around with subclassing a listbox so that each cell has a “title” and “subtitle” like the ios tableview cell has (and maybe “image”, etc, later also, but I guess the principle will be the same).

Is this possible to do from within the listbox, or better start with a canvas and like add a “subtitlecell” class?

It should be possible through cellTextPaint for Text and CellBackgroundPaint for image. No need to subclass the cell (I frankly don’t see how to do this) but you can perfectly well subclass the Listbox.

In terms of properties of the subclass, I believe using cellTag to store these values would work. If you plan to add image, it would be convenient to store a dictionary there, so you can add whatever you want at any time.

You could have two CellTitle(row, column) methods, one to set, another to get, same thing for Subtitle, same thing for picture.

Listbox cells are not objects in their own right so there is no way to subclass a cell

the BEST you can do is subclass listbox & then do custom drawing using the events like cellbackgroundpaint, celltextpaint, etc

Got it. thanks, guys.

@Norman Palardy has there ever been any thought of maing listbox cells objects? Just curious, really.

not that I know of
Listbox is already one of the most complex bits of code in the entire framework and adding in cell objects &/or row & column objects would only make it more so