Have you got a screenshot of you application now, using the Grid? 
What grid are you using, TStringGrid?   I once maintained a app that
had a very complex screen using 4 TStringGrids and it looked and
worked beautifully.

To explain the code a supplied.  It actually uses the TStringList Sort
method to do the sorting.  It adds the references to the TListItems
and the correct text from the Listview (depending on what column
header was clicked) to the stringlist.  It then calls the stringlist
sort method.    I then run through the StringList assigning the stored
TListItems back to the TListView.  Simple but effective!  ;-)

The code is generic enough, to allow you to do a copy/paste into the
ColumnClick event.

I like your idea of just surfacing the Sort property of the TListview
without implementation, so the user can implement there own sorting
algorithm.

Regards,
  - Graeme -




On 2/28/06, A.J. Venter <[EMAIL PROTECTED]> wrote:
> On Tuesday 28 February 2006 12:45, Graeme Geldenhuys wrote:
> > Hi AJ,
> >
> > I might be to late for you, but this is how I did my sorting in a
> > TListview.  It doesn't need to clear the Listview while sorting.  You
> > might need to reset the .Selected though.
> >
> > This code goes into the ColumnClick event of the TListview:
> >
> Thanks for this, though indeed it won´t help me now. Having USED a grid and
> seen the power of using cell-draw events to display rather than maintaining a
> list (instant speed increases all around - and BIG NOTICEABLE ones) I am
> certainly not going back, not while my program needs to handle an average of
> 12000 entries per session.
> That said, I haven´t studied your code in detail but the thought occurs to me
> that nearly every listview sort tutorial for delphi uses an assignment to the
> customsort event, just about nobody seems to use built-in sorts so perhaps
> the easiest way to get more compatible is simple to export the right
> properties from the LCL to ALLOW people to assign a customsort method - which
> would of course still have to be written by the user.
> This won´t implement tlistview.sort (for which mind you, your code may be a
> good start if you feel like working out how to make it a patch) but it WILL
> allow all those customsort based projects to work on lazarus.
>
> Thoughts ?

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to