[SOLVED] Sort StringGrid when Column Title is Clicked by User lazarus / 31-LCL ---------------------------------------------------------------------- Gizmo · 2012-05-04 22:27 Hey I've read http://wiki.lazarus.freepascal.org/Grids_Reference_Page#Sort ing_Columns_or_Rows which is useful to learn how to sort a grid by a column when the grid is clicked generally, but what I'm after is to discover how to sort my grid in the same way that spreadhseets do...i.e. if I have Column1, Column 2 and Column3 and I want to sort the user to be able to sort by Column2 if the user clicks the grey title area of Column2. Likewise for Column1 or 3. Code: [Select]procedure TForm1.StringGrid1Click(Sender: TObject); begin   Stringgrid1.SortColRow(true, 1);  // This sorts by column 2 works when I just click the grid,   // but how can I sort by column 2 when, and only when, the user clicks the title area of the column?   end; ?? Thanks Ted ---------------------------------------------------------------------- Gizmo · 2012-05-04 22:31 Just answered this myself...the StringGrid properties has a 'ColumnClickSorts' which I can just set to true. Amazingly cool. Thanks ---------------------------------------------------------------------- Robot · 2012-05-05 01:30 property ColumnClickSorts ? are you sure ? i do'nt find this property in stringgrid. ---------------------------------------------------------------------- Gizmo · 2012-05-09 12:37 In v1.1 using FPC 2.6.1+, yes. I have created a second SG and applied the same property.