Recent

Author Topic: DBGrid: show image in cell  (Read 4938 times)

derles

  • New Member
  • *
  • Posts: 35
DBGrid: show image in cell
« on: February 11, 2016, 09:51:55 pm »
Hi. I have in a DBGrid a column linked to a integer field. The field is expected to asume values 1, 2 or 3.
I need to show a small icon or image in the cell, different for each value (1 = red light, 2 = tellow light and 3 = green light, like a semaphore).
How can I proceed in Lazarus to do this?
I´m using Lazarus 1.0.10, win32, FPC 2.6.2

Thks !

Daniel
« Last Edit: February 11, 2016, 09:56:54 pm by derles »

jesusr

  • Sr. Member
  • ****
  • Posts: 499
Re: DBGrid: show image in cell
« Reply #1 on: February 12, 2016, 06:30:00 am »
In examples/gridexamples there is a TSemaphoreDbGrid component in the semaphordbgrids.pas file.

derles

  • New Member
  • *
  • Posts: 35
Re: DBGrid: show image in cell
« Reply #2 on: February 12, 2016, 03:40:26 pm »
Tks jesusr, but this component seems to be specific for that purpose only.
In fact i need to show more than traffic lights, so I'm looking for a code portion that shows me how to draw custom images in a cell in general.

I know how to do ir in delphi, but in Lazarus DBGrid seems to be a bit different in this feature.

 

TinyPortal © 2005-2018