RE: TZF - TzGrid Colors
Alex Mackinnon <[email protected]> Thu, 6 Nov 2003 16:24:50 -0000
| Newsgroups | gmane.comp.lang.delphi.topaz |
|---|---|
| Message-ID | <[email protected]> |
I'm sending the message below again... Forgive me if two copies turn up
but the first one seems to have got stalled somewhere.
A.
====================================
I missed many of your earlier posts but I think I've figured out what
you are trying to do.
But it's got me puzzled... why when what you want to do is TzGrid
related were you talking about making the changes to a descendant of
TzDBF?
More logical would be to descend a new component from TzGrid and add the
behaviour to that... you can also obsolete your dependance on a global
variable by adding a new 'MasterDB' property (published) to the
component and make setting the tracking a no-brainer.
A.
===============================================
unit descdemo;
interface
uses
Windows, Graphics, Classes, DB, Grids, DbGrids, tzprimds, ucommon,
utzcds, utzfds, atzgrids;
type
TTzGridRC=class(TTzGrid)
private
_masterdb:TTzDbf;
procedure ChangeColors(Sender: TObject; curRow: Integer;
var IndicatorColor, CellColor, CellTextColor, HiliteColor,
HiliteTextColor, DeletedColor, DeletedTextColor: TColor);
public
constructor Create(AOwner: TComponent); override;
published
property MasterDB:TTzDBF read _masterdb write _masterdb;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('SSI', [TTzGridRC]);
end;
{ TTzGridRC }
procedure TTzGridRC.ChangeColors(Sender: TObject; curRow: Integer;
var IndicatorColor, CellColor, CellTextColor, HiliteColor,
HiliteTextColor, DeletedColor, DeletedTextColor: TColor);
begin
if Assigned(DataSource) and Assigned(DataSource.DataSet)
and Assigned(_masterdb) then
begin
if _masterdb.recNo=DataSource.DataSet.RecNo then
begin
// CellColor:=$00B3A8FF;
CellColor:=$0033FFFF;
DeletedColor:=clRed;
HiliteColor:=$00ffff01;
CellTextColor:=clBLACK;
HiliteTextColor:=clBLACK;
// Canvas.Font.Style:=Canvas.Font.Style+[fsBold];
// Canvas.Font.Size:=12;
end
else
begin
CellColor:=$00B3F8FF;
HiliteColor:=$00B3F8FF;
CellTextColor:=clBlack;
HiliteTextColor:=clBlack;
// Canvas.Font.Style:=Canvas.Font.Style-[fsBold];
// Canvas.Font.Size:=8;
end;
end;
end;
constructor TTzGridRC.Create(AOwner: TComponent);
begin
inherited;
// _masterdb:=nil;
OnChangeColorsEvent:=ChangeColors;
end;
End.
--^----------------------------------------------------------------
This email was sent to: [email protected]
EASY UNSUBSCRIBE click here: http://topica.com/u/?clvXPN.a5kvff.Z2NsZHQt
Or send an email to: [email protected]
TOPICA - Start your own email discussion group. FREE!
http://www.topica.com/partner/tag02/create/index2.html
--^----------------------------------------------------------------