LCL: Minor optimization for Grid column sort.

git-svn-id: trunk@30717 -
This commit is contained in:
juha 2011-05-13 09:06:40 +00:00
parent 4ee7294cd2
commit 1e6d1a65e8

View File

@ -3257,7 +3257,6 @@ begin
with FColumns[ColOfs].Title do with FColumns[ColOfs].Title do
ImageIndex := FOldImageIndex; ImageIndex := FOldImageIndex;
end; end;
FSortColumn := index;
// Show the sort glyph only if clicked column has a TGridColumn defined. // Show the sort glyph only if clicked column has a TGridColumn defined.
ColOfs := index - FFixedCols; ColOfs := index - FFixedCols;
if (ColOfs > -1) and (ColOfs < FColumns.Count) if (ColOfs > -1) and (ColOfs < FColumns.Count)
@ -3265,13 +3264,14 @@ begin
and (FDescImgInd < TitleImageList.Count) then and (FDescImgInd < TitleImageList.Count) then
with FColumns[ColOfs].Title do begin with FColumns[ColOfs].Title do begin
// Save previous ImageIndex of the clicked column. // Save previous ImageIndex of the clicked column.
if (ImageIndex <> FAscImgInd) and (ImageIndex <> FDescImgInd) then if (index <> FSortColumn) then
FOldImageIndex := ImageIndex; FOldImageIndex := ImageIndex;
case FSortOrder of // Show the right sort glyph. case FSortOrder of // Show the right sort glyph.
soAscending: ImageIndex := FAscImgInd; soAscending: ImageIndex := FAscImgInd;
soDescending: ImageIndex := FDescImgInd; soDescending: ImageIndex := FDescImgInd;
end; end;
end; end;
FSortColumn := index;
Sort(True, index, FFixedRows, RowCount-1); Sort(True, index, FFixedRows, RowCount-1);
end; end;
end; end;