Skip to main content

TdxShellTreeView.Folders Property

Provides indexed access to displayed shell items.

Declaration

property Folders[AIndex: Integer]: TcxShellFolder read;

Property Value

Type Description
TcxShellFolder

A shell item (a file, folder, or shell item link).

Use the FolderCount property to obtain the number of shell items accessible through this property.

Remarks

Use the Folders property to access visible (expanded) shell items. The OnAddFolder event occurs for every new displayed node (folder) every time a node with nested folders is expanded.

Code Example

The following code example displays the name and type of the first selected shell item in the application form caption:

var
  AFolder: TcxShellFolder;
begin
  if ((dxShellTreeView1.FolderCount = 0) or (dxShellTreeView1.SelectionCount = 0)) then Exit;
  AFolder := dxShellTreeView1.Folders[dxShellTreeView1.Selections[0].Index];
  Caption := 'The ' + AFolder.DisplayName;
  if AFolder.IsFolder then
  begin
    Caption := Caption + ' folder is selected';
    if AFolder.SubFolders then
      Caption := Caption + '; includes nested folders';
  end
  else if((AFolder.IsLink) or (AFolder.IsFolderLink) or (AFolder.IsZipFolderLink)) then
    Caption := Caption + ' shell item link is selected'
  else
    Caption := Caption + ' file is selected';
end;
See Also