summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-08-21 09:45:41 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-08-21 09:45:41 +0000
commita8913923c0700dc69876fe5cc9d187d209148260 (patch)
tree5abeb24b69625677f8c367a658f4d56f89518bff
parent8a8e10a680a7773bf91f460598363d640d1dce66 (diff)
downloadfpGUI-a8913923c0700dc69876fe5cc9d187d209148260.tar.xz
* Minor StringGrid patch adding ColumnAlignment property. Thanks Michael van Canneyt.
-rw-r--r--src/gui/gui_grid.pas22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gui/gui_grid.pas b/src/gui/gui_grid.pas
index b15900a0..489da421 100644
--- a/src/gui/gui_grid.pas
+++ b/src/gui/gui_grid.pas
@@ -80,12 +80,16 @@ type
end;
+ { TfpgCustomStringGrid }
+
TfpgCustomStringGrid = class(TfpgCustomGrid)
private
function GetCell(ACol, ARow: Integer): string;
+ function GetColumnAlignment(ACol: Integer): TAlignment;
function GetColumnTitle(ACol: Integer): string;
function GetObjects(ACol, ARow: Integer): TObject;
procedure SetCell(ACol, ARow: Integer; const AValue: string);
+ procedure SetColumnAlignment(ACol: Integer; const AValue: TAlignment);
procedure SetColumnTitle(ACol: Integer; const AValue: string);
procedure SetObjects(ACol, ARow: Integer; const AValue: TObject);
protected
@@ -106,6 +110,7 @@ type
property Objects[ACol, ARow: Integer]: TObject read GetObjects write SetObjects;
property ColumnTitle[ACol: Integer]: string read GetColumnTitle write SetColumnTitle;
property ColumnWidth[ACol: Integer]: integer read GetColumnWidth write SetColumnWidth;
+ property ColumnAlignment[ACol: Integer]: TAlignment read GetColumnAlignment write SetColumnAlignment;
property ColumnBackgroundColor;
property ColumnTextColor;
// property Cols[index: Integer]: TStrings read GetCols write SetCols;
@@ -310,6 +315,13 @@ begin
Result := TfpgStringColumn(FColumns.Items[ACol]).Cells[ARow];
end;
+function TfpgCustomStringGrid.GetColumnAlignment(ACol: Integer): TAlignment;
+begin
+ if ACol > ColumnCount-1 then
+ Exit; //==>
+ Result := TfpgStringColumn(FColumns.Items[ACol]).Alignment;
+end;
+
function TfpgCustomStringGrid.GetColumnTitle(ACol: Integer): string;
begin
if ACol > ColumnCount-1 then
@@ -348,6 +360,16 @@ begin
end;
end;
+procedure TfpgCustomStringGrid.SetColumnAlignment(ACol: Integer;
+ const AValue: TAlignment);
+begin
+ if ACol > ColumnCount-1 then
+ Exit; //==>
+ BeginUpdate;
+ TfpgStringColumn(FColumns.Items[ACol]).Alignment := AValue;
+ EndUpdate;
+end;
+
procedure TfpgCustomStringGrid.SetColumnTitle(ACol: Integer; const AValue: string);
begin
if ACol > ColumnCount-1 then