We help IT Professionals succeed at work.

Programatically Auto-Sort TAdvStringGrid using its in-built sort functionality

Mike Littlewood
Mike Littlewood used Ask the Experts™
on
Title says it all, but basically I want to sort a TAdvStringGrid.

The manual sort properties to set when doing a multi column sort on a TAdvStringGrid (property SortSettings: Show = True, IndexShow = True).

What I would like to do is call this via code rather than on the click of the title headers, and I would like to do a multi sort simulating left clicking one column and then shift left click a second.

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Nevermind, after a little digging I found the answer.
Here it is for anyone who might need for the future.
Ill see if I can just get this question closed off but not deleted.

with AdvStringGrid do
begin
      SortIndexes.Clear;
      SortIndexes.AddIndex(3, True);  // first parameter is column number, second is if you want to sort ascending
      SortIndexes.AddIndex(2, True);
      QSortIndexed;
end;
Closed, 125 points refunded.
kb
Experts Exchange Moderator