Recent

Author Topic: Grid with text and a BitBtn on each row  (Read 416 times)

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Grid with text and a BitBtn on each row
« on: June 24, 2022, 02:11:14 pm »
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

  • Hero Member
  • *****
  • Posts: 11858
Re: Grid with text and a BitBtn on each row
« Reply #1 on: June 24, 2022, 04:15:05 pm »
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.
« Last Edit: June 24, 2022, 05:31:31 pm by wp »

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Re: Grid with text and a BitBtn on each row
« Reply #2 on: June 27, 2022, 09:26:00 am »
Ok, sounds fine, a TListView it is.

 

TinyPortal © 2005-2018