mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-07 15:59:30 +01:00
dbgrid: update active row if active record changed (bug #7934)
git-svn-id: trunk@10502 -
This commit is contained in:
parent
17ee7d3f7d
commit
be37b3ea24
@ -2336,6 +2336,9 @@ var
|
|||||||
CurActiveRecord: Integer;
|
CurActiveRecord: Integer;
|
||||||
begin
|
begin
|
||||||
if FDataLink.Active then begin
|
if FDataLink.Active then begin
|
||||||
|
{$ifdef dbgGridPaint}
|
||||||
|
DebugLn('DrawAllRows: Link.ActiveRecord=%d, Row=%d',[FDataLink.ActiveRecord, Row]);
|
||||||
|
{$endif}
|
||||||
CurActiveRecord:=FDataLink.ActiveRecord;
|
CurActiveRecord:=FDataLink.ActiveRecord;
|
||||||
FDrawingEmptyDataset:=FDatalink.DataSet.IsEmpty;
|
FDrawingEmptyDataset:=FDatalink.DataSet.IsEmpty;
|
||||||
end else
|
end else
|
||||||
@ -2377,7 +2380,7 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
inherited DrawRow(ARow);
|
inherited DrawRow(ARow);
|
||||||
{$ifdef dbgGridPaint}
|
{$ifdef dbgGridPaint}
|
||||||
DebugLn('End Row')
|
DebugLn(' End Row')
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2501,6 +2504,7 @@ begin
|
|||||||
// find out the column count, if result=0 then
|
// find out the column count, if result=0 then
|
||||||
// there are no visible columns defined or dataset is inactive
|
// there are no visible columns defined or dataset is inactive
|
||||||
// or there are no visible fields, ie the grid is blank
|
// or there are no visible fields, ie the grid is blank
|
||||||
|
{$IfDef dbgDBGrid}DebugLn('TCustomDbgrid.UpdateGridCounts INIT');{$endif}
|
||||||
BeginVisualChange;
|
BeginVisualChange;
|
||||||
try
|
try
|
||||||
Result := GetColumnCount;
|
Result := GetColumnCount;
|
||||||
@ -2528,11 +2532,15 @@ begin
|
|||||||
RowCount := RecCount;
|
RowCount := RecCount;
|
||||||
FixedRows := FRCount;
|
FixedRows := FRCount;
|
||||||
FixedCols := FCCount;
|
FixedCols := FCCount;
|
||||||
|
|
||||||
UpdateGridColumnSizes;
|
UpdateGridColumnSizes;
|
||||||
|
|
||||||
|
SetColRow(Col, FixedRows + FDatalink.ActiveRecord);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
EndVisualChange;
|
EndVisualChange;
|
||||||
end;
|
end;
|
||||||
|
{$IfDef dbgDBGrid}DebugLn('TCustomDbgrid.UpdateGridCounts END');{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomDBGrid.UpdateVertScrollbar(const aVisible: boolean;
|
procedure TCustomDBGrid.UpdateVertScrollbar(const aVisible: boolean;
|
||||||
|
|||||||
@ -658,7 +658,6 @@ type
|
|||||||
procedure SetTopRow(const AValue: Integer);
|
procedure SetTopRow(const AValue: Integer);
|
||||||
procedure TryScrollTo(aCol,aRow: integer);
|
procedure TryScrollTo(aCol,aRow: integer);
|
||||||
procedure UpdateScrollBarPos(Which: TScrollStyle);
|
procedure UpdateScrollBarPos(Which: TScrollStyle);
|
||||||
procedure UpdateSelectionRange;
|
|
||||||
procedure WriteColumns(Writer: TWriter);
|
procedure WriteColumns(Writer: TWriter);
|
||||||
procedure WriteColWidths(Writer: TWriter);
|
procedure WriteColWidths(Writer: TWriter);
|
||||||
procedure WriteRowHeights(Writer: TWriter);
|
procedure WriteRowHeights(Writer: TWriter);
|
||||||
@ -795,6 +794,7 @@ type
|
|||||||
function SelectCell(ACol, ARow: Integer): Boolean; virtual;
|
function SelectCell(ACol, ARow: Integer): Boolean; virtual;
|
||||||
procedure SetCanvasFont(aFont: TFont);
|
procedure SetCanvasFont(aFont: TFont);
|
||||||
procedure SetColor(Value: TColor); override;
|
procedure SetColor(Value: TColor); override;
|
||||||
|
procedure SetColRow(const ACol,ARow: Integer);
|
||||||
procedure SetEditText(ACol, ARow: Longint; const Value: string); dynamic;
|
procedure SetEditText(ACol, ARow: Longint; const Value: string); dynamic;
|
||||||
procedure SetBorderStyle(NewStyle: TBorderStyle); override;
|
procedure SetBorderStyle(NewStyle: TBorderStyle); override;
|
||||||
procedure SetFixedcolor(const AValue: TColor); virtual;
|
procedure SetFixedcolor(const AValue: TColor); virtual;
|
||||||
@ -805,6 +805,7 @@ type
|
|||||||
function TryMoveSelection(Relative: Boolean; var DCol, DRow: Integer): Boolean;
|
function TryMoveSelection(Relative: Boolean; var DCol, DRow: Integer): Boolean;
|
||||||
procedure UnLockEditor;
|
procedure UnLockEditor;
|
||||||
procedure UpdateHorzScrollBar(const aVisible: boolean; const aRange,aPage: Integer); virtual;
|
procedure UpdateHorzScrollBar(const aVisible: boolean; const aRange,aPage: Integer); virtual;
|
||||||
|
procedure UpdateSelectionRange;
|
||||||
procedure UpdateVertScrollbar(const aVisible: boolean; const aRange,aPage: Integer); virtual;
|
procedure UpdateVertScrollbar(const aVisible: boolean; const aRange,aPage: Integer); virtual;
|
||||||
procedure UpdateBorderStyle;
|
procedure UpdateBorderStyle;
|
||||||
procedure VisualChange; virtual;
|
procedure VisualChange; virtual;
|
||||||
@ -2677,6 +2678,13 @@ begin
|
|||||||
inherited SetColor(Value);
|
inherited SetColor(Value);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomGrid.SetColRow(const ACol, ARow: Integer);
|
||||||
|
begin
|
||||||
|
FCol := ACol;
|
||||||
|
FRow := ARow;
|
||||||
|
UpdateSelectionRange;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomGrid.DrawBorder;
|
procedure TCustomGrid.DrawBorder;
|
||||||
var
|
var
|
||||||
R: TRect;
|
R: TRect;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user