[Lazarus] Sorting StringGrid by column click

Alexander Klenin klenin at gmail.com
Thu May 12 12:26:49 CEST 2011


On Thu, May 12, 2011 at 21:05, Juha (gmail) <juha.manninen62 at gmail.com> wrote:
> Alexander Klenin kirjoitti maanantai, 9. toukokuuta 2011 14:42:04:
>> But what if the user wants his own images for sorting?
>> Then again, maybe there are no such users...
>
> One option is to add published properties ColumnSortImageUp and
> ColumnSortImageDown.
> The user could set them to point his own images. If not set then the default
> images would be used. It would be very flexible but requires 2 more properties
> which may confuse some people.
> What do you think?

As a compromise, you hard-code, say,
ColumnSortImageUp = 0 and ColumnSortImageDown = 1, but document that
prominently.
Another variant is to create a ColumnSorting property with sub-properties
Enabled, ImageUp, ImageDown, UseBuiltinImages (if =true, use built-in ImageList
even if the user supplied his own).

BTW, I agree with the commenter in Mantis who said that sorting type
is a required
requisite. Sorting numeric columns as strings is not merely useless, but subtly
dangerous, since it may deceive user with incorrect results.

-- 
Alexander S. Klenin




More information about the Lazarus mailing list