Recent

Author Topic: [Solved] TStringGrid Column sorting  (Read 1490 times)

jcmontherock

  • Sr. Member
  • ****
  • Posts: 272
[Solved] TStringGrid Column sorting
« on: November 13, 2024, 04:07:26 pm »
In Lazarus 4.0RC1 TStringGrid images indicating the sort direction in column's header have been changed. There are more little and when we have a column header with a background color we don't see them anymore. I prefer the old ones. So, I replaced the new images (sortasc.png, srtdesc.png) in directory "Lazarus\LCL\Images" with the old from Lazarus 3.6. But after recompiling my application when I sort a column the new images (of 4.0RC1) are still there. I suppose that there is a TImagelist loaded at componnent compilation. I did not find where. Is somebody knows how to replace these images ?
« Last Edit: November 14, 2024, 03:41:55 pm by jcmontherock »
Windows 11 UTF8-64 - Lazarus 4RC1-64 - FPC 3.2.2

Awkward

  • Full Member
  • ***
  • Posts: 144
Re: TStringGrid Column sorting
« Reply #1 on: November 13, 2024, 05:14:29 pm »
Grid props ImageIndexSortAsc and ImageIndexSortDesc can help i think

Sieben

  • Sr. Member
  • ****
  • Posts: 367
Re: TStringGrid Column sorting
« Reply #2 on: November 13, 2024, 05:21:47 pm »
How about looking for any $R directive in Grids.pas...?
Lazarus 2.2.0, FPC 3.2.2, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

wp

  • Hero Member
  • *****
  • Posts: 12474
Re: TStringGrid Column sorting
« Reply #3 on: November 13, 2024, 08:07:38 pm »
I prefer the old ones. So, I replaced the new images (sortasc.png, srtdesc.png) in directory "Lazarus\LCL\Images" with the old from Lazarus 3.6. But after recompiling my application when I sort a column the new images (of 4.0RC1) are still there.
These images are contained in the application resources which are not recreated automatically. After replacing the images you must recreate the res file: Execute the "lcl_grid_images.bat" file on Windows or the "lcl_grid_images.sh" on Linux (you must compile the program lazres first, it is in the "tools" folder of the Lazarus installation). Then go to "Tools" > "Configure Build Lazarus". Imporant: Check "Clean all" and "Switch after building to automatically". Then click "Build". After a while the IDE will restart with the new sort images in its resources.

The easier and more flexible way, however, is to assign an ImageList to the grid which contains the sort icons at the indices that you specify as ImageIndexSortAsc and ImageIndexSortDesc, as already mentioned by Awkward.

jcmontherock

  • Sr. Member
  • ****
  • Posts: 272
Re: TStringGrid Column sorting
« Reply #4 on: November 14, 2024, 11:44:23 am »
Thanks a lot I will try it. :D
Windows 11 UTF8-64 - Lazarus 4RC1-64 - FPC 3.2.2

jcmontherock

  • Sr. Member
  • ****
  • Posts: 272
Re: TStringGrid Column sorting
« Reply #5 on: November 14, 2024, 03:40:34 pm »
With my own ImageList it's really easy. Thanks everybody.
Windows 11 UTF8-64 - Lazarus 4RC1-64 - FPC 3.2.2

 

TinyPortal © 2005-2018