[Lazarus] TListView sorting

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] TListView sorting

Hans-Peter Diettrich
In an review of the TListView sorting procedure I could fix most
problems already. Remaining question:

Is it possible to change the parameter lists of:

TWSCustomListView.SetSort(const ALV: TCustomListView; const AType:
TSortType; const AColumn: Integer);

into

TWSCustomListView.SetSort(const ALV: TCustomListView; SortProc:
TListSortCompare; const Data: lParam);

There exists no need to pass the sorting parameters, because these are
accessible in every sort procedure. Instead a custom compare function
and a custom sort argument should be passed, to allow for Delphi
compatible custom sorting:
TCustomListView.CustomSort(SortProc; lParam); //types to be fixed

IMO every widgetset will allow to implement above change.

DoDi


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TListView sorting

William Oliveira Ferreira
Overloading?

Send your suggestion as an overload implementation, i think will solve your problem and don't start a backward incompatible implementation...
________________________________
William de Oliveira Ferreira
Bacharel em Sistemas de Informação



2011/2/6 Hans-Peter Diettrich <[hidden email]>
In an review of the TListView sorting procedure I could fix most problems already. Remaining question:

Is it possible to change the parameter lists of:

TWSCustomListView.SetSort(const ALV: TCustomListView; const AType: TSortType; const AColumn: Integer);

into

TWSCustomListView.SetSort(const ALV: TCustomListView; SortProc: TListSortCompare; const Data: lParam);

There exists no need to pass the sorting parameters, because these are accessible in every sort procedure. Instead a custom compare function and a custom sort argument should be passed, to allow for Delphi compatible custom sorting:
TCustomListView.CustomSort(SortProc; lParam); //types to be fixed

IMO every widgetset will allow to implement above change.

DoDi


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TListView sorting

Hans-Peter Diettrich
William Oliveira Ferreira schrieb:
> Overloading?
>
> Send your suggestion as an overload implementation, i think will solve
> your problem and don't start a backward incompatible implementation...

See my patch on issue #18666. I also adds sorting to the ToDoList...

DoDi

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TListView sorting

Hans-Peter Diettrich
In reply to this post by William Oliveira Ferreira
William Oliveira Ferreira schrieb:
> Overloading?
>
> Send your suggestion as an overload implementation, i think will solve
> your problem and don't start a backward incompatible implementation...

I've just updated issue #18716, with two bugs found in the
implementation. Now my ToDoList works as expected, i.e. jumps to the
correct source code even after sorting the list :-)

If this topic is of general interest, and when my suggestions are
implemented in the LCL, I can check the behaviour with other widgetsets,
too.

DoDi


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus