TAdvStringGrid

Example 37 : sorting on selected fixed rows of choice

vcl grid sorting

This is a small demo for 2 new features in TAdvStringGrid 2.0 First, it is now possible to define the fixed row from where column sorting is controlled. Secondly, vertical cell alignment can now be controlled per cell through the OnGetAlignment event hander.

To allow another row to trigger and show sorts of columns, set the new grid.SortSettings.Row property to the row of choice. Note that this must be a fixed row.

Further, the cell alignment in this sample is set by the following OnGetAlignment event handler:

procedure TForm1.AdvStringGrid1GetAlignment(Sender: TObject; ARow, ACol: Integer; var HAlign: TAlignment; var VAlign: TVAlignment);
begin
  if ARow > 1 then
  begin
    if odd(ARow) then
    else
      VAlign := vtaBottom;
    if odd(ACol) then
    else
      HAlign := taRightJustify;
  end;
end;


Delphi project & source files for downloading included in the main demos distribution for Delphi.