RE: TZF - TzGrid Colors
Alex Mackinnon <[email protected]> Thu, 6 Nov 2003 15:04:35 -0000
| Newsgroups | gmane.comp.lang.delphi.topaz |
|---|---|
| Message-ID | <[email protected]> |
The answer about wrapping the variable was right in front of you
really... just stick the global into the class/component...
unit descdemo;
interface
uses
Classes, DB, tzprimds, ucommon, utzcds, utzfds;
type
TTzDBFRC=class(TTzDBF)
private
public
globMasterRecordNo:Integer;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('SSI', [TTzDBFRC]);
end;
end.
...after you drop an instance of the class/component on the form the
variable will be available,
Regards,
A.
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: 06 November 2003 14:10
To: [email protected]
Subject: Re: TZF - TzGrid Colors
globMasterRecordNo is variable in my main form.
And I use it to "communicate" between the tzGrid
and TzDBF objects.
In creating a descendent object of TTzGrid, I dont
know to communicate the CurrentRecord number
(from an unknown TzDBF object) to the TTzGrid.
NOTE TO MARIE: If you are going to use this
code we have developed, you need to modify
the TzDBF.AfterScroll code. Here is my
latest AfterScroll:
procedure TfrmDM.DBF_DocMovtAfterScroll(DataSet: TDataSet);
begin
if DBF_DocMovt.ControlsDisabled then exit; // without this statement
I get a run-time error from the Grid
frmMain.globDocMovtRecNo:=DBF_DocMovt.RecNo;
frmMain.TzGrid_RecPck.refreshGrid;
end;
I am certain all of these global variables could be "wrapped up" in
a new TzDBF object, but I have not figured out how, as of yet.
Bob
__________________
unit U_Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs, Grids, DBGrids, atzgrids, DB, tzprimds, ucommon, utzcds,
utzfds;
type
TForm1 = class(TForm)
<SNIP>
private
{ Private declarations }
public
{ Public declarations }
globCurrentMasterRecordNo:LongInt;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.TzGrid1ChangeColorsEvent(Sender: TObject; curRow:
Integer;
var IndicatorColor, CellColor, CellTextColor, HiliteColor,
HiliteTextColor, DeletedColor, DeletedTextColor: TColor);
begin
if tzDBF1.recNo=globCurrentMasterRecordNo 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;
procedure TForm1.TzDbf1AfterScroll(DataSet: TDataSet);
begin
globCurrentMasterRecordNo:=tzDBF1.RecNo;
tzgrid1.refreshgrid;
end;
end.
In a message dated 11/06/2003 7:24:10 AM Eastern Standard Time,
[email protected] writes:
Open up the source file for TTzDBF (if that's where it's needed)... find
a reference to 'globMasterRecordNo'... track it back to it's source file
and add that file to the 'uses' section of your new unit.
BTW I don't seem to see any reference to a 'globMasterRecordNo' in my
topaz source...
A.
--^----------------------------------------------------------------
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
--^----------------------------------------------------------------