Subject | Re: [IBO] OnGetCellProps |
---|---|
Author | Mack |
Post date | 2005-08-01T01:26:08Z |
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;
--- In IBObjects@yahoogroups.com, "Antti Kurenniemi" <Antti@A...>
wrote:
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;
--- In IBObjects@yahoogroups.com, "Antti Kurenniemi" <Antti@A...>
wrote:
> The Contacts demo in the IBO\Samples\Contact folder is a goodexample, just
> look at the code for OnGetCellProps.like
>
>
> Antti Kurenniemi
>
> ----- Original Message -----
> From: "Mack" <jonathanmfreedman@h...>
> To: <IBObjects@yahoogroups.com>
> Sent: Friday, July 29, 2005 8:55 PM
> Subject: [IBO] OnGetCellProps
>
>
> >I did a search and could not find any messages on this...i would
> > to know how to use OnGetCellProps to change the color of onecell in
> > grid
> >
> >