diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-10-01 14:45:48 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-10-01 14:45:48 +0000 |
commit | 227c28d9f7f7b3d30dc2df2bc3a4a935e4c4ba64 (patch) | |
tree | d62c93b603d135ad703212505c367c5330c63507 /src/gui | |
parent | caf2f2c9a38328ca554c14c210ea8a092152e89b (diff) | |
download | fpGUI-227c28d9f7f7b3d30dc2df2bc3a4a935e4c4ba64.tar.xz |
* Implemented the Objects[ACol,ARow] property for the StringGrid.
* Implemented the StringGrid composite mediator for use with tiOPF.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui_grid.pas | 23 | ||||
-rw-r--r-- | src/gui/gui_listview.pas | 5 |
2 files changed, 25 insertions, 3 deletions
diff --git a/src/gui/gui_grid.pas b/src/gui/gui_grid.pas index 81441965..0d64c09a 100644 --- a/src/gui/gui_grid.pas +++ b/src/gui/gui_grid.pas @@ -158,8 +158,10 @@ type private function GetCell(ACol, ARow: LongWord): string; function GetColumnTitle(ACol: integer): string; + function GetObjects(ACol, ARow: LongWord): TObject; procedure SetCell(ACol, ARow: LongWord; const AValue: string); procedure SetColumnTitle(ACol: integer; const AValue: string); + procedure SetObjects(ACol, ARow: LongWord; const AValue: TObject); protected function GetColumnWidth(ACol: integer): integer; override; procedure SetColumnWidth(ACol: integer; const AValue: integer); override; @@ -175,7 +177,7 @@ type function AddColumn(ATitle: string; AWidth: integer; AAlignment: TAlignment = taLeftJustify): TfpgStringColumn; overload; { ACol and ARow is 1-based. } property Cells[ACol, ARow: LongWord]: string read GetCell write SetCell; -// property Objects[ACol, ARow: Integer]: TObject read GetObjects write SetObjects; + property Objects[ACol, ARow: LongWord]: TObject read GetObjects write SetObjects; property ColumnTitle[ACol: integer]: string read GetColumnTitle write SetColumnTitle; property ColumnWidth[ACol: integer]: integer read GetColumnWidth write SetColumnWidth; // property Cols[index: Integer]: TStrings read GetCols write SetCols; @@ -678,6 +680,15 @@ begin Result := TfpgStringColumn(FColumns.Items[ACol-1]).Title; end; +function TfpgCustomStringGrid.GetObjects(ACol, ARow: LongWord): TObject; +begin + if ACol > ColumnCount then + Exit; //==> + if ARow > RowCount then + Exit; //==> + Result := TfpgStringColumn(FColumns.Items[ACol-1]).Cells.Objects[ARow-1]; +end; + function TfpgCustomStringGrid.GetColumnWidth(ACol: integer): integer; begin if ACol > ColumnCount then @@ -707,6 +718,16 @@ begin RePaint; end; +procedure TfpgCustomStringGrid.SetObjects(ACol, ARow: LongWord; + const AValue: TObject); +begin + if ACol > ColumnCount then + Exit; //==> + if ARow > RowCount then + Exit; //==> + TfpgStringColumn(FColumns.Items[ACol-1]).Cells.Objects[ARow-1] := AValue; +end; + procedure TfpgCustomStringGrid.SetColumnWidth(ACol: integer; const AValue: integer); begin if ACol > ColumnCount then diff --git a/src/gui/gui_listview.pas b/src/gui/gui_listview.pas index 52a0946d..62c3cbd1 100644 --- a/src/gui/gui_listview.pas +++ b/src/gui/gui_listview.pas @@ -1398,10 +1398,11 @@ begin Canvas.SetClipRect(iColumnClipRect); if FColumns.Column[J].ColumnIndex <> -1 then ColumnIndex := FColumns.Column[J].ColumnIndex - else ColumnIndex := J; + else + ColumnIndex := J; if ColumnIndex = 0 then TheText := Item.Caption - else if item.SubItems.Count > ColumnIndex then + else if Item.SubItems.Count > ColumnIndex then TheText := Item.SubItems.Strings[ColumnIndex-1] else TheText := ''; |