Recent

Author Topic: TStringGrid ColumnClickSort - how to 'unsort' ?  (Read 1847 times)

FrankBKK

  • New Member
  • *
  • Posts: 22
TStringGrid ColumnClickSort - how to 'unsort' ?
« on: June 15, 2021, 09:33:23 am »
TStringGrid allows to change the sorting of a column via ColumnClickSort when clicking on the Header, click again to switch Asc/Desc sort order.

How can I get back the original, unsorted view ?






Zvoni

  • Hero Member
  • *****
  • Posts: 686
Re: TStringGrid ColumnClickSort - how to 'unsort' ?
« Reply #1 on: June 15, 2021, 09:42:11 am »
You can't.
Except if you saved the "original" sort somewhere
One System to rule them all, One IDE to find them,
One Code to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
People call me crazy, because i'm jumping out of perfectly fine aircraft

FrankBKK

  • New Member
  • *
  • Posts: 22
Re: TStringGrid ColumnClickSort - how to 'unsort' ?
« Reply #2 on: June 15, 2021, 07:24:13 pm »
Thanks for the quick reply - that's bad though ....

What is the best approach to circumvent this ?

A secondary backup grid to restore the original sort order seems like overkill and to add an add. sort column is something I try to avoid - are there any other options ?

Awkward

  • Jr. Member
  • **
  • Posts: 90
Re: TStringGrid ColumnClickSort - how to 'unsort' ?
« Reply #3 on: June 15, 2021, 07:39:20 pm »
why not to add hidden column with numbers for original order and sort by it when needs?

Zvoni

  • Hero Member
  • *****
  • Posts: 686
Re: TStringGrid ColumnClickSort - how to 'unsort' ?
« Reply #4 on: June 15, 2021, 09:56:57 pm »
IIRC, the row-Property (or was it rows?) is of type TStrings, so a TStringList could/should work
One System to rule them all, One IDE to find them,
One Code to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
People call me crazy, because i'm jumping out of perfectly fine aircraft

 

TinyPortal © 2005-2018