[Lazarus] Sorting StringGrid by column click
Juha (gmail)
juha.manninen62 at gmail.com
Mon May 9 10:51:06 CEST 2011
I almost always want my StringGrids to sort automatically when user clicks a
column title.
So, I implemeted such feature as property ColumnClickSorts (r30630 + some
others for images).
Jesus Reyes and others, please test.
Some notes:
- I created sort glyph images using my artistic skills and Gimp...
... ok, I just rotated an existing image 90 decrees.
I would be happy if someone creates / finds better images.
- ImageList is created "on the fly" if not set by user.
The sort glyphs and loaded dynamically in any case.
The only potential error comes when user first clicks the columns, ImageList
gets created, and later user's code assigns another ImageList. It wouldn't
crash but wrong images would be shown. I think this is very rare and can
easily be avoided, so it is not a real problem.
- Sorting works for all columns but the glyphs are shown only for persistent,
user defined columns. It is so by definition. If you want to see images you must
define columns.
- Column.Title.ImageIndex is now -1 by default. Value 0 as default is wrong
because it is a valid list index.
Regards,
Juha
More information about the Lazarus
mailing list