LCL/grids: Show sort arrows in header of sorted grid even if the grid does not define columns (issue #33731).

git-svn-id: trunk@57960 -
This commit is contained in:
wp 2018-05-18 21:05:49 +00:00
parent c21d026d03
commit 7ea1e8cd31

View File

@ -120,7 +120,8 @@ type
TGridOption2 = (
goScrollToLastCol, // allow scrolling to last column (so that last column can be leftcol)
goScrollToLastRow // allow scrolling to last row (so that last row can be toprow)
goScrollToLastRow, // allow scrolling to last row (so that last row can be toprow)
goShowSortArrows // show arrows in header when column is sorted
);
TGridOptions2 = set of TGridOption2;
@ -4133,7 +4134,7 @@ var
Details: TThemedElementDetails;
NativeSortGlyphs: Boolean;
begin
if FSortColumn = AColumnIndex then
if (FSortColumn = AColumnIndex) and (goShowSortArrows in FOptions2) then
begin
GetSortTitleImageInfo(AColumnIndex, ImgList, ImgIndex, ImgListWidth, NativeSortGlyphs);
if NativeSortGlyphs then// draw native sort buttons
@ -4492,6 +4493,13 @@ begin
tlBottom: Dec(ARect.Bottom, varCellPadding);
end;
if (gdFixed in aState) and (FSortColumn = aCol) and
(goShowSortArrows in FOptions2) then
begin
DrawColumnTitleImage(aRect, FSortColumn);
dec(ARect.Right, 2*varCellPadding);
end;
if ARect.Right<ARect.Left then
ARect.Right:=ARect.Left;
if ARect.Left>ARect.Right then
@ -9258,6 +9266,7 @@ begin
Cfg.SetValue(Path+'goRowHighlight/value', goRowHighlight in Options);
Cfg.SetValue(Path+'goScrollToLastCol/value', goScrollToLastCol in Options2);
Cfg.SetValue(Path+'goScrollToLastRow/value', goScrollToLastRow in Options2);
Cfg.SetValue(Path+'goShowSortArrows/value', goShowSortArrows in Options2);
end;
procedure TCustomGrid.LoadColumns(cfg: TXMLConfig; Version: integer);
@ -9454,6 +9463,7 @@ begin
end;
GetValue2('goScrollToLastRow',goScrollToLastRow);
GetValue2('goScrollToLastCol',goScrollToLastCol);
GetValue2('goShowSortArrows',goShowSortArrows);
Options:=Opt;
Options2:=Opt2;
@ -9496,9 +9506,8 @@ begin
FAutoEdit := True;
FFocusRectVisible := True;
FDefaultDrawing := True;
FOptions:=
[goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect,
goSmoothScroll ];
FOptions := DefaultGridOptions;
FOptions2 := DefaultGridOptions2;
FScrollbars:=ssAutoBoth;
fGridState:=gsNormal;
FDefColWidth:=-1;