While not solution to your actual problem.... Have you considered using a calculated field to display the information? You could put your tests in their and display that value in the grid. For example we often display a 'P' column that indicates an item was printed. The field is Boolean so the std data shows true or false words. We create a calcd string field and display a 'X' if printed.
Robert Martin Software Engineer Wild Software Ltd ----- Original Message ----- From: "John Christenhusz" <[EMAIL PROTECTED]> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> Sent: Monday, October 15, 2001 4:53 PM Subject: [DUG]: dbGrid > 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/ > --------------------------------------------------------------------------- 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/