mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-26 13:19:29 +02:00
LCL, improved grids TAB-ing, options goTabs or dgTabs, issue #16007
git-svn-id: trunk@27374 -
This commit is contained in:
parent
3b670b01a2
commit
dc4e797f5b
@ -1962,7 +1962,22 @@ begin
|
|||||||
doOnKeyDown;
|
doOnKeyDown;
|
||||||
if Key<>0 then begin
|
if Key<>0 then begin
|
||||||
if dgTabs in Options then begin
|
if dgTabs in Options then begin
|
||||||
|
|
||||||
|
if ((ssShift in shift) and
|
||||||
|
(Col<=GetFirstVisibleColumn) and (Row<=GetFirstVisibleRow)) then begin
|
||||||
|
if EditorKey then
|
||||||
|
GridFlags := GridFlags + [gfRevEditorTab];
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
GetDeltaMoveNext(ssShift in Shift, DeltaCol, DeltaRow);
|
GetDeltaMoveNext(ssShift in Shift, DeltaCol, DeltaRow);
|
||||||
|
|
||||||
|
if (not (ssShift in Shift)) and (Row>=GetLastVisibleRow) and
|
||||||
|
(DeltaRow>0) and (Col=GetLastVisibleColumn) and
|
||||||
|
(FDatalink.Editing or not GridCanModify) then begin
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
MoveSel(false);
|
MoveSel(false);
|
||||||
Key := 0;
|
Key := 0;
|
||||||
end;
|
end;
|
||||||
|
@ -907,6 +907,10 @@ type
|
|||||||
function GetEditMask(ACol, ARow: Longint): string; virtual;
|
function GetEditMask(ACol, ARow: Longint): string; virtual;
|
||||||
function GetEditText(ACol, ARow: Longint): string; virtual;
|
function GetEditText(ACol, ARow: Longint): string; virtual;
|
||||||
function GetFixedcolor: TColor; virtual;
|
function GetFixedcolor: TColor; virtual;
|
||||||
|
function GetFirstVisibleColumn: Integer;
|
||||||
|
function GetFirstVisibleRow: Integer;
|
||||||
|
function GetLastVisibleColumn: Integer;
|
||||||
|
function GetLastVisibleRow: Integer;
|
||||||
function GetSelectedColor: TColor; virtual;
|
function GetSelectedColor: TColor; virtual;
|
||||||
function GridColumnFromColumnIndex(ColumnIndex: Integer): Integer;
|
function GridColumnFromColumnIndex(ColumnIndex: Integer): Integer;
|
||||||
procedure GridMouseWheel(shift: TShiftState; Delta: Integer); virtual;
|
procedure GridMouseWheel(shift: TShiftState; Delta: Integer); virtual;
|
||||||
@ -6103,6 +6107,20 @@ var
|
|||||||
Exclude(FGridFlags, gfEditingDone);
|
Exclude(FGridFlags, gfEditingDone);
|
||||||
Key := 0; { Flag key as handled, even if selected cell did not move }
|
Key := 0; { Flag key as handled, even if selected cell did not move }
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TabCheckEditorKey;
|
||||||
|
begin
|
||||||
|
if FEditorKey then begin
|
||||||
|
{$IFDEF dbggrid}
|
||||||
|
DebugLn('Got TAB, shift=',dbgs(sh));
|
||||||
|
{$endif}
|
||||||
|
if sh then
|
||||||
|
GridFlags := GridFlags + [gfRevEditorTab]
|
||||||
|
else
|
||||||
|
GridFlags := GridFlags + [gfEditorTab];
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
const
|
const
|
||||||
cBidiMove:array[Boolean] of Integer = (1, -1);
|
cBidiMove:array[Boolean] of Integer = (1, -1);
|
||||||
begin
|
begin
|
||||||
@ -6121,18 +6139,17 @@ begin
|
|||||||
if GetDeltaMoveNext(Sh, DeltaCol,DeltaRow) then begin
|
if GetDeltaMoveNext(Sh, DeltaCol,DeltaRow) then begin
|
||||||
Sh := False;
|
Sh := False;
|
||||||
MoveSel(True, DeltaCol, DeltaRow);
|
MoveSel(True, DeltaCol, DeltaRow);
|
||||||
end;
|
Key:=0;
|
||||||
Key:=0;
|
end else
|
||||||
end else
|
if (AutoAdvance=aaNone) or
|
||||||
if FEditorKey then begin
|
((AutoAdvance=aaDown) and (Row>=GetLastVisibleRow)) or
|
||||||
{$IFDEF dbggrid}
|
(sh and (Col<=GetFirstVisibleColumn)) or
|
||||||
DebugLn('Got TAB, shift=',dbgs(sh));
|
((not sh) and (Col>=GetLastVisibleColumn)) then
|
||||||
{$endif}
|
TabCheckEditorKey
|
||||||
if sh then
|
|
||||||
GridFlags := GridFlags + [gfRevEditorTab]
|
|
||||||
else
|
else
|
||||||
GridFlags := GridFlags + [gfEditorTab];
|
Key := 0;
|
||||||
end;
|
end else
|
||||||
|
TabCheckEditorKey;
|
||||||
end;
|
end;
|
||||||
VK_LEFT:
|
VK_LEFT:
|
||||||
begin
|
begin
|
||||||
@ -7567,6 +7584,34 @@ begin
|
|||||||
result:=FFixedColor;
|
result:=FFixedColor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomGrid.GetFirstVisibleColumn: Integer;
|
||||||
|
begin
|
||||||
|
result := FixedCols;
|
||||||
|
while (result<ColCount) and (ColWidths[result]=0) do
|
||||||
|
inc(result); // extreme case may return colcount
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCustomGrid.GetFirstVisibleRow: Integer;
|
||||||
|
begin
|
||||||
|
result := FixedRows;
|
||||||
|
while (result<RowCount) and (RowHeights[result]=0) do
|
||||||
|
inc(result); // ditto
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCustomGrid.GetLastVisibleColumn: Integer;
|
||||||
|
begin
|
||||||
|
result := ColCount-1;
|
||||||
|
while (result>=0) and (ColWidths[result]=0) do
|
||||||
|
dec(result); // extreme case may return -1
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCustomGrid.GetLastVisibleRow: integer;
|
||||||
|
begin
|
||||||
|
result := RowCount-1;
|
||||||
|
while (result>=0) and (RowHeights[result]=0) do
|
||||||
|
dec(result); // ditto
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomGrid.ColWidthsChanged;
|
procedure TCustomGrid.ColWidthsChanged;
|
||||||
begin
|
begin
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user