Subject Re: [IBO] OnGetCellProps
Author Antti Kurenniemi
Sorry, my C++ is under par so I can't really help with this.


Antti Kurenniemi

----- Original Message -----
From: "Mack" <jonathanmfreedman@...>
To: <IBObjects@yahoogroups.com>
Sent: Monday, August 01, 2005 4:26 AM
Subject: Re: [IBO] OnGetCellProps


This is the use of the procedure in Delphi...there apparently is no
C++ equivalent to Assigned. Translating everything else in C++ but
that leads to an AV...what next?

procedure TfrmContact.grContactGetCellProps(Sender: TObject; ACol,
ARow: Integer; AState: TGridDrawState; var AColor: TColor; AFont:
TFont);
var
dat: string;
tmpFld: TIB_Column;
begin
// This provides an example of how colors and fonts can be
customized on an
// individual basis.

// It also shows how any row of data can be peeked at without having
to worry
// about messing up the display of data.
if dsContact.Active then
begin
with dsContact.DataSet do
begin
BufferRowNum := grContact.DataRow[ ARow ];
if BufferRowNum > 0 then
begin

// This provides an example of how colors can be customized on an
// individual cell basis.
tmpFld := grContact.GridFields[ grContact.DataCol[ ACol ]];
if Assigned( tmpFld ) and ( tmpFld.FieldName = 'LASTNAME' )
then
begin
dat := BufferFieldByName('CON_TYPE').AsString;
if dat = 'FAMILY' then
begin
if AColor = grContact.Color then
AColor := clLime;
end;
end;
if AFont.Color <> clHighlightText then
begin
dat := BufferFieldByName('CON_TYPE').AsString;
if dat = 'FRIEND' then
AFont.Color := clBlue
else
if dat = 'FAMILY' then
AFont.Color := clRed
else
AFont.Color := clWindowText;
end;
end;
end;
end;
end;