Recent

Author Topic: ClumnClickSorts in StringGrid at start  (Read 797 times)

bigeno

  • Sr. Member
  • ****
  • Posts: 266
ClumnClickSorts in StringGrid at start
« on: December 12, 2018, 11:47:53 am »
I've ClumnClickSorts:=true in StringGrid. It works when I click on column header (arrow icon show and sorting start). All good.
But is there any way to do this at start (onformshow) by default on some column ? emulate that click ?

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: ClumnClickSorts in StringGrid at start
« Reply #1 on: December 12, 2018, 12:02:29 pm »
You want to sort the grid when the program starts? Just call the method SortColRow which has the column to be sorted as a parameter ("Index") in addition to a boolean parameter ("IsColumn") determining whether you want to sort by columns or by rows. There is also an overloaded version in which you can determine which rows (if you are sorting by column - or columns if your are sorting by rows) you want to include in the sort ("FromIndex", "ToIndex")

Code: Pascal  [Select][+][-]
  1.     procedure SortColRow(IsColumn: Boolean; index:Integer); overload;
  2.     procedure SortColRow(IsColumn: Boolean; Index,FromIndex,ToIndex: Integer); overload;

 

TinyPortal © 2005-2018