| Class TcwXTab (unit Cwxtab) |
TStringGrid
the declaration for the crosstab component
| Constructors |
constructor create(aOwner: TComponent);| Functions |
destructor destroy;
procedure Execute;
procedure SaveXTab(const sTable: string);
procedure UpdateXTab;
procedure DrawCell(Sender: TObject; Col, Row: Longint;Rect: TRect; State: TGridDrawState);*Paint Routines**************************************************************} {draw cell - this routine allows a cell to contain more than one line of text
procedure AddSummaries;
procedure DrawCellContents(const iRow, iCol: integer; eArray: TarrFloat);
function FindBiggestStr(const sCell: string): integer;
function GetCellContents(const iRow, iCol: integer): TarrFloat;
procedure PopCols;
procedure PopRows;
procedure PopXTab;
procedure RunQuery(const sSQL: string);
procedure SetAgg(value: boolean);
procedure SetCells(value: boolean);
procedure SetEmptyChar(value: TEmptyChar);
procedure SetTable(value: TTable);
procedure SetXtab(value: TXObject);| Properties |
property AggRowsCols : boolean
property AutoResize : boolean
property Crosstab : TXObject
property EmptyCellChar : TEmptyChar
property Table : TTable| Events |
| Variables |
FCurrent : boolean;
FAgg : boolean;
FAutoResizeCells : boolean;
FEmptyChar : TEmptyChar;
FTable : TTable;
FXTab : TXObject;
Query1 : TQuery;| Constructors |
constructor create(aOwner: TComponent);constructor
| Functions |
destructor destroy;destructor
procedure Execute;*XTab custom routines*******************************************************} {execute
procedure SaveXTab(const sTable: string);*I\O Routines*****************************************************************} {save crosstab as a table. Note that parameter is the table name, so should be no greater than eight characters
procedure UpdateXTab;update XTAb
procedure DrawCell(Sender: TObject; Col, Row: Longint;Rect: TRect; State: TGridDrawState);Protected declarations
*Paint Routines**************************************************************} {draw cell - this routine allows a cell to contain more than one line of text
procedure AddSummaries;add summaries to the crosstab. Basically this routine will add a column and row, and populate both of these with the sum of the results in the respective cells.
procedure DrawCellContents(const iRow, iCol: integer; eArray: TarrFloat);draw cell contents - takes the array of floats and draws it into the cell as specified in the parameters
function FindBiggestStr(const sCell: string): integer;return required pixels for string passed
function GetCellContents(const iRow, iCol: integer): TarrFloat;get cell contents - returns the cell contents as an array of float. Note that this routine is quite complex, since we have to read the values from the cell and, without knowing how many lines there are in the cell, split the text into the array
procedure PopCols;populate columns - read distinct values from column field into the grid's columns
procedure PopRows;populate rows - read distinct values from row field into the grid's rows
procedure PopXTab;populate cross-tab - the crux of the component. Lots of code that basically concerns itself with iterating through the table, finding values in the row and column fields that match the current cell row\column headings, and then performing the math operation as specified by the developer
procedure RunQuery(const sSQL: string);run query - this is used by PopRows and PopCols to execute their SQL statements
procedure SetAgg(value: boolean);set aggregate
procedure SetCells(value: boolean);set cell heights and widths
procedure SetEmptyChar(value: TEmptyChar);set empty char
procedure SetTable(value: TTable);set Table
procedure SetXtab(value: TXObject);set custom object which holds crosstab
| Properties |
property AggRowsCols : boolean
property AutoResize : boolean
property Crosstab : TXObjectPublished declarations
property EmptyCellChar : TEmptyChar
property Table : TTable| Events |
| Variables |
FCurrent : boolean;Public declarations
FAgg : boolean;
FAutoResizeCells : boolean;
FEmptyChar : TEmptyChar;
FTable : TTable;
FXTab : TXObject;
Query1 : TQuery;Private declarations