Forum > LCL

Grid with text and a BitBtn on each row

(1/1)

SymbolicFrank:
I have to display a multi-row list of string data, with a row that shows the status in the form of a picture. Clicking it should cycle the available images.

The easiest way that I could find seems to be a list or array for the data and a DrawGrid for the display. But there's probably a simpler way. Who can tell me?

wp:
The easiest way, I think, is to use a TListView rather than a TStringGrid/TDrawGrid because it has built-in image support. Just add the images to an ImageList, and when you add the data as TListItem you specify the image index. In the OnMouseDown or OnClick event you can determine whether a click occured on the image and switch to the next image (or whatever index you want).

If you insist on TStringGrid/TDrawGrid you must owner-draw the cells.

SymbolicFrank:
Ok, sounds fine, a TListView it is.

Navigation

[0] Message Index

Go to full version