TTMSFNCTreeView: Sorting is not functioning in VCL

Hi

sorting is not functional not even in the Demo (VCL).

TMSFNCTreeView version : 1.2.2.0
Used on Delphi 12.1

Best regards

Radu Capota

We have no issues here, tested the VCL demo. Please provide more info or steps to reproduce.

I just run the Demo, i click on one column and after 10-20 seconds appears the sorting icon and after that sorting is not more functional. I use Delphi 12.1 Enterprise.

I have observed that sometimes Sorting is working in Demo after a new compiling the project but in most of cases not (and has the behaviour described). I change nothing in the Demo just i recompile it.

Did you turn on Sorting each time you started the demo?

Yes, with no doubt.

Are you able to reproduce this in a new blank application? Because we cannot reproduce this here whatsoever.

Yes, i took the TMSFNCTreeview from the Demo on a new blank application, and i get the same results: sometimes works but in most cases not ; i just compile it several times with no modifications

unit Unit38;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, VCL.TMSFNCTypes, VCL.TMSFNCUtils, VCL.TMSFNCGraphics, VCL.TMSFNCGraphicsTypes, VCL.TMSFNCCustomComponent, VCL.TMSFNCBitmapContainer, VCL.TMSFNCCustomControl, VCL.TMSFNCTreeViewBase, VCL.TMSFNCTreeViewData, VCL.TMSFNCCustomTreeView, VCL.TMSFNCTreeView;

type
TForm38 = class(TForm)
TMSFNCTreeView1: TTMSFNCTreeView;
TMSFNCBitmapContainer1: TTMSFNCBitmapContainer;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form38: TForm38;

implementation

{$R *.dfm}

procedure TForm38.FormCreate(Sender: TObject);
var
i:integer;
begin
for I := 0 to TMSFNCTreeView1.Columns.Count - 1 do
TMSFNCTreeView1.Columns[I].Sorting := tcsRecursive;
end;

end.

Thanks, we'll investigate this here asap

1 Like

Hi,

You need to use the following code to make sure the treeview is properly updated with the correct settings. In fact, BeginUpdate / EndUpdate is common practice with FNC controls, and also gives the benefit of speeding up the process of adding large amount of items/nodes

procedure TForm1.FormCreate(Sender: TObject);
var
  i: integer;
begin
  TMSFNCTreeView1.BeginUpdate;
  for i := 0 to TMSFNCTreeView1.Columns.Count - 1 do
    TMSFNCTreeView1.Columns[i].Sorting := tcsRecursive;
  TMSFNCTreeView1.EndUpdate;
end;

Hi

with BeginUpdate end EndUpdate i have the same problem. Sometimes works and sometime not after compiling the simple project with just one TMSFNCTreeView on the form.

Fixed! Thanks for reporting.

1 Like

It is available in version 6.3.0.0?

No, we need to release an update, coming next week.