Recent

Author Topic: Sort more String Grid columns  (Read 879 times)

arneolav

  • Full Member
  • ***
  • Posts: 195
    • ElTranslador
Sort more String Grid columns
« on: March 05, 2021, 05:42:29 pm »
I'v not found any solution on sorting more than one column in a stringrid so I made an, may be "quick an dirty simple solution.
Then main principle is to concatenate values into one field an sort this field, all done in event CompareCells.
In testing this seems to work very well.
Any comments are welcome!




Win XP, Win7, Win 10, Win 11, win64 , Lazarus 3.0RC1
Delphi/DevExpress

Handoko

  • Hero Member
  • *****
  • Posts: 5129
  • My goal: build my own game engine using Lazarus
Re: Sort more String Grid columns
« Reply #1 on: March 05, 2021, 06:04:16 pm »
Bookmarked. It will be useful for my next projects.

Thank you for sharing it.

arneolav

  • Full Member
  • ***
  • Posts: 195
    • ElTranslador
Re: Sort more String Grid columns
« Reply #2 on: March 05, 2021, 06:53:42 pm »
You are welcome.

Attached som more tips concerning sorting.

In the grid, Object Inspector, I have ColumnClickSorts set to false.
Option goThumbTracking = true.

Read more here:
https://wiki.freepascal.org/Grids_Reference_Page
« Last Edit: March 06, 2021, 04:20:02 pm by arneolav »
Win XP, Win7, Win 10, Win 11, win64 , Lazarus 3.0RC1
Delphi/DevExpress

 

TinyPortal © 2005-2018