G'day folks,

I've asked this question before and did get a satisfactory reply at that
time, but after all it doesn't seem to work the way I want it to.

What I want is to change the presentation of a dbGrig's field only when the
field ('Type') = 2.

Pseudo code:
When Type = 2 then
begin
  when field DateOut >= now then
    show a string 'YES'
  else
    show a string 'NO'
end


This works fine for the very first presentation. But when I scroll down
(removing the top records with a 'YES') and then up again, then the records
with a 'YES' have changed to 'NO'. For some reason the
dbgridSearchDrawDataCell event doesn't seem to correspond with the actual
data.


The code I use is:

procedure TformREDB.dbgridSearchDrawDataCell(Sender: TObject; const Rect:
TRect; Field: TField; State: TGridDrawState);
begin
  if (field.name = 'tblClientType') then
  begin
    if tblClientType.asInteger = 2 then
      if tblClientDateOut.asDateTime >= now then
        dbgridSearch.Canvas.textOut(rect.left + 5,  rect.top + 1, 'Yes');
       else
        dbgridSearch.Canvas.textOut(rect.left + 5,  rect.top + 1, 'No');


Any ideas???

TIA




---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to