Coloring rows in a DBGrid depending on values
Posted on 2001-08-27
Hello. I am having trouble in working with component TDBGrid in Delphi 4, as I don't know how to paint entire rows permanently.
I will explain my problem in detail:
I am doing an application that needs to control how much time people are inside a room. I have a form with a DBGrid with all the possible people stored in a Paradox table. Then I click a button and, in this precise moment, the record which is being selected in the grid, is supposed to get into the room. Then, from that moment that gets into the room (when I click some button) I have a timer controlling how much time that person spends inside the room. The timer checks every 5 minutes that the person has not overpassed some time limit. If so, I need the grid to paint in color RED, for example, the row corresponding to that person, and leave the rest of the rows as they are. I also would need to paint in different colors depending on time intervals I previously would define. The result would be a DBGrid with different permanent colors in some rows indicating how much time are the people in the room.
Can you understand what I need? It is a simple concept, but hard to program for me.
Ask anything if you have doubts.
If you think you have the solution, please copy & paste example code to make the solution easier.
Thanks in advance,