summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/fpg_customgrid.pas9
-rw-r--r--src/gui/fpg_grid.pas15
2 files changed, 24 insertions, 0 deletions
diff --git a/src/gui/fpg_customgrid.pas b/src/gui/fpg_customgrid.pas
index 7b042799..b5a6c191 100644
--- a/src/gui/fpg_customgrid.pas
+++ b/src/gui/fpg_customgrid.pas
@@ -91,6 +91,7 @@ type
destructor Destroy; override;
function AddColumn(ATitle: string; AWidth: integer): TfpgGridColumn; virtual;
procedure DeleteColumn(AIndex: integer); virtual;
+ procedure DeleteRow(AIndex: integer); virtual;
procedure MoveColumn(oldindex, newindex: integer); virtual;
end;
@@ -351,6 +352,14 @@ begin
end;
end;
+procedure TfpgCustomGrid.DeleteRow(AIndex: integer);
+begin
+ if (AIndex < 0) or (AIndex > FRowCount-1) then
+ Exit;
+ { This is just some sanity checking. Actual row deletion must occur in
+ descendant classed. See TfpgStringGrid for an example. }
+end;
+
procedure TfpgCustomGrid.MoveColumn(oldindex, newindex: integer);
begin
FColumns.Move(oldindex, newindex);
diff --git a/src/gui/fpg_grid.pas b/src/gui/fpg_grid.pas
index 72fd29bf..3eecf7c1 100644
--- a/src/gui/fpg_grid.pas
+++ b/src/gui/fpg_grid.pas
@@ -106,6 +106,7 @@ type
constructor Create(AOwner: TComponent); override;
function AddColumn(ATitle: string; AWidth: integer; AAlignment: TAlignment = taLeftJustify;
AbackgroundColor: TfpgColor = clDefault; ATextColor: TfpgColor = clDefault): TfpgStringColumn; overload;
+ procedure DeleteRow(AIndex: integer); override;
property Cells[ACol, ARow: Integer]: string read GetCell write SetCell;
property Objects[ACol, ARow: Integer]: TObject read GetObjects write SetObjects;
property ColumnTitle[ACol: Integer]: string read GetColumnTitle write SetColumnTitle;
@@ -513,5 +514,19 @@ begin
Updated; // if we called .BeginUpdate then don't clear csUpdating here
end;
+procedure TfpgCustomStringGrid.DeleteRow(AIndex: integer);
+var
+ c: integer;
+begin
+ inherited DeleteRow(AIndex); // does sanity checks
+ for c := 0 to FColumns.Count-1 do
+ begin
+ TfpgStringColumn(FColumns[c]).Cells.Delete(AIndex);
+ end;
+ FRowCount := FRowCount-1;
+ if HasHandle then
+ Update;
+end;
+
end.