mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 17:39:16 +02:00
Improve Delphi compatibility from Colin Western
git-svn-id: trunk@7367 -
This commit is contained in:
parent
4b1881f23a
commit
4b5ad03da8
@ -627,6 +627,8 @@ type
|
|||||||
procedure BeforeMoveSelection(const DCol,DRow: Integer); virtual;
|
procedure BeforeMoveSelection(const DCol,DRow: Integer); virtual;
|
||||||
procedure CalcAutoSizeColumn(const Index: Integer; var AMin,AMax,APriority: Integer); dynamic;
|
procedure CalcAutoSizeColumn(const Index: Integer; var AMin,AMax,APriority: Integer); dynamic;
|
||||||
procedure CalcFocusRect(var ARect: TRect);
|
procedure CalcFocusRect(var ARect: TRect);
|
||||||
|
function CanEditShow: Boolean; virtual;
|
||||||
|
function CanGridAcceptKey(Key: Word; Shift: TShiftState): Boolean; dynamic;
|
||||||
procedure CellClick(const aCol,aRow: Integer); virtual;
|
procedure CellClick(const aCol,aRow: Integer); virtual;
|
||||||
procedure CheckLimits(var aCol,aRow: Integer);
|
procedure CheckLimits(var aCol,aRow: Integer);
|
||||||
procedure ColRowDeleted(IsColumn: Boolean; index: Integer); dynamic;
|
procedure ColRowDeleted(IsColumn: Boolean; index: Integer); dynamic;
|
||||||
@ -792,6 +794,7 @@ type
|
|||||||
property GridLineStyle: TPenStyle read FGridLineStyle write SetGridLineStyle;
|
property GridLineStyle: TPenStyle read FGridLineStyle write SetGridLineStyle;
|
||||||
property GridLineWidth: Integer read FGridLineWidth write SetGridLineWidth default 1;
|
property GridLineWidth: Integer read FGridLineWidth write SetGridLineWidth default 1;
|
||||||
property GridWidth: Integer read FGCache.GridWidth;
|
property GridWidth: Integer read FGCache.GridWidth;
|
||||||
|
property InplaceEditor: TWinControl read FEditor;
|
||||||
property LeftCol:Integer read GetLeftCol write SetLeftCol;
|
property LeftCol:Integer read GetLeftCol write SetLeftCol;
|
||||||
property Options: TGridOptions read FOptions write SetOptions;
|
property Options: TGridOptions read FOptions write SetOptions;
|
||||||
property Row: Integer read FRow write SetRow;
|
property Row: Integer read FRow write SetRow;
|
||||||
@ -843,6 +846,7 @@ type
|
|||||||
function IscellSelected(aCol,aRow: Integer): Boolean;
|
function IscellSelected(aCol,aRow: Integer): Boolean;
|
||||||
function IscellVisible(aCol, aRow: Integer): Boolean;
|
function IscellVisible(aCol, aRow: Integer): Boolean;
|
||||||
procedure LoadFromFile(FileName: string);
|
procedure LoadFromFile(FileName: string);
|
||||||
|
function MouseCoord(X,Y: Integer): TGridCoord;
|
||||||
function MouseToCell(Mouse: TPoint): TPoint; overload;
|
function MouseToCell(Mouse: TPoint): TPoint; overload;
|
||||||
procedure MouseToCell(X,Y: Integer; var ACol,ARow: Longint); overload;
|
procedure MouseToCell(X,Y: Integer; var ACol,ARow: Longint); overload;
|
||||||
function MouseToLogcell(Mouse: TPoint): TPoint;
|
function MouseToLogcell(Mouse: TPoint): TPoint;
|
||||||
@ -2354,6 +2358,11 @@ procedure TCustomGrid.ColRowDeleted(IsColumn: Boolean; index: Integer);
|
|||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomGrid.CanEditShow: Boolean;
|
||||||
|
begin
|
||||||
|
Result := (goEditing in Options) and not (csDesigning in ComponentState);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomGrid.Paint;
|
procedure TCustomGrid.Paint;
|
||||||
begin
|
begin
|
||||||
Inherited Paint;
|
Inherited Paint;
|
||||||
@ -4286,6 +4295,8 @@ begin
|
|||||||
{$ifdef dbgGrid}DebugLn('Grid.KeyDown INIT Key=',IntToStr(Key));{$endif}
|
{$ifdef dbgGrid}DebugLn('Grid.KeyDown INIT Key=',IntToStr(Key));{$endif}
|
||||||
inherited KeyDown(Key, Shift);
|
inherited KeyDown(Key, Shift);
|
||||||
if not FGCache.ValidGrid then Exit;
|
if not FGCache.ValidGrid then Exit;
|
||||||
|
if not CanGridAcceptKey(Key, Shift) then
|
||||||
|
Key:=0; // Allow CanGridAcceptKey to override Key behaviour
|
||||||
Sh:=(ssShift in Shift);
|
Sh:=(ssShift in Shift);
|
||||||
Relaxed:=not (goRowSelect in Options) or (goRelaxedRowSelect in Options);
|
Relaxed:=not (goRowSelect in Options) or (goRelaxedRowSelect in Options);
|
||||||
|
|
||||||
@ -4448,6 +4459,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomGrid.MouseCoord(X, Y: Integer): TGridCoord;
|
||||||
|
begin
|
||||||
|
Result := MouseToCell(Point(X,Y));
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomGrid.ISCellVisible(aCol, aRow: Integer): Boolean;
|
function TCustomGrid.ISCellVisible(aCol, aRow: Integer): Boolean;
|
||||||
begin
|
begin
|
||||||
with FGCache.VisibleGrid do
|
with FGCache.VisibleGrid do
|
||||||
@ -4754,6 +4770,7 @@ begin
|
|||||||
DebugLn('InvalidateCell Col=',IntToStr(aCol),
|
DebugLn('InvalidateCell Col=',IntToStr(aCol),
|
||||||
' Row=',IntToStr(aRow),' Redraw=', BoolToStr(Redraw));
|
' Row=',IntToStr(aRow),' Redraw=', BoolToStr(Redraw));
|
||||||
{$Endif}
|
{$Endif}
|
||||||
|
if not HandleAllocated then Exit;
|
||||||
R:=CellRect(aCol, aRow);
|
R:=CellRect(aCol, aRow);
|
||||||
InvalidateRect(Handle, @R, Redraw);
|
InvalidateRect(Handle, @R, Redraw);
|
||||||
end;
|
end;
|
||||||
@ -4773,7 +4790,7 @@ end;
|
|||||||
|
|
||||||
procedure TCustomGrid.EditorGetValue;
|
procedure TCustomGrid.EditorGetValue;
|
||||||
begin
|
begin
|
||||||
if not (csDesigning in ComponentState) then begin
|
if not (csDesigning in ComponentState) and (Editor<>nil) and Editor.Visible then begin
|
||||||
EditorDoGetValue;
|
EditorDoGetValue;
|
||||||
EditorHide;
|
EditorHide;
|
||||||
end;
|
end;
|
||||||
@ -4815,7 +4832,7 @@ begin
|
|||||||
if not HandleAllocated then
|
if not HandleAllocated then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
if (goEditing in Options) and
|
if (goEditing in Options) and CanEditShow and
|
||||||
not FEditorShowing and (Editor<>nil) and not Editor.Visible then
|
not FEditorShowing and (Editor<>nil) and not Editor.Visible then
|
||||||
begin
|
begin
|
||||||
{$ifdef dbgGrid} DebugLn('EditorShow [',Editor.ClassName,']INIT FCol=',IntToStr(FCol),' FRow=',IntToStr(FRow));{$endif}
|
{$ifdef dbgGrid} DebugLn('EditorShow [',Editor.ClassName,']INIT FCol=',IntToStr(FCol),' FRow=',IntToStr(FRow));{$endif}
|
||||||
@ -5264,6 +5281,11 @@ procedure TCustomGrid.SetEditText(ACol, ARow: Longint; const Value: string);
|
|||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomGrid.CanGridAcceptKey(Key: Word; Shift: TShiftState): Boolean;
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomGrid.SetSelectedColor(const AValue: TColor);
|
procedure TCustomGrid.SetSelectedColor(const AValue: TColor);
|
||||||
begin
|
begin
|
||||||
if FSelectedColor<>AValue then begin
|
if FSelectedColor<>AValue then begin
|
||||||
|
Loading…
Reference in New Issue
Block a user