<p style="padding:0 0 0 0; margin:0 0 0 0;">I understand. Method Sort; is protected (as it is in Delphi).</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">You have probably no other choice than do</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> ListView1.SortDirection:=sdDescending;</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> ListView1.SortDirection:=sdAscending;</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">which works but it is unefficient, sorting is done twice.</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">I tried:</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> ListView1.BeginUpdate;</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> ListView1.SortDirection:=sdDescending;</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> ListView1.EndUpdate;</p>
<div><span style="font-size: 10pt;"> ListView1.SortDirection:=sdAscending;</span></div>
<div>but it doesn't help, sorting is still done twice (at least on Qt).</div>
<div>ListView has some flags to avoid sorting but those flags are private.</div>
<div>V.</div>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">______________________________________________________________<br />
> Od: "Valdas Jankūnas" <zmuogs@gmail.com><br />
> Komu: Lazarus mailing list <lazarus@lists.lazarus.freepascal.org><br />
> Datum: 14.04.2015 15:02<br />
> Předmět: Re: [Lazarus] Strange Alphasort in ListView<br />
></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">2015.04.14 15:34, Vojtěch Čihák rašė:<br />
> No, it isn't a bug.<br />
><br />
> In sources, you can see comment:<br />
><br />
> function AlphaSort: Boolean; // always sorts column 0 in sdAscending order<br />
<br />
Looked not in *primary* source (Google, Documentation) :)<br />
<br />
><br />
> So if you want other sorting, you must set three sort-related properties:<br />
><br />
> ListView1.SortColumn:=1;<br />
> ListView1.SortDirection:=sdAscending;<br />
> ListView1.SortType:=stText;<br />
><br />
> It works, I just tested in Qt.<br />
<br />
Why I came to AlphaSort: in my source ListView is cleared (columns stays <br />
same) and populated with new info. After that current column (say <br />
SortColumn=1) is no sorted (Autosort is TRUE; tried in Qt, Gtk2 and Win) <br />
so I must somehow to trigger sorting. But how?<br />
<br />
<br />
-- <br />
Valdas Jankūnas<br />
<br />
--<br />
_______________________________________________<br />
Lazarus mailing list<br />
Lazarus@lists.lazarus.freepascal.org<br />
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a></p>