Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TcxShellFolder Class

A shell item.

#Declaration

Delphi
TcxShellFolder = class(
    TObject
)

#Remarks

A shell item corresponds to a folder, file, or virtual shell item (a link to a file or folder, for example).

#Main API Members

The list below outlines key members of the TcxShellFolder class. These members allow you to identify the shell item type, obtain shell item attributes, and interact with underlying Windows Shell objects.

#Shell Item Attributes

Attributes | Capabilities | Properties | StorageCapabilities
Return shell item attribute flags.
DisplayName | PathName
Return the display name of the shell item and its full path.
IsFolder | IsFolderLink | IsLink | IsZip | IsZipFolderLink
Allow you to identify the shell item type.
SubFolders
Allows you to identify if the shell item has nested folders.
CreateAbsolutePidl | RelativePIDL
Return the shell item’s Windows Shell identifiers.
ShellFolder | ParentShellFolder
Provides access to underlying and parent Windows Shell items.

#Code Examples: Identify Selected Shell Items

#TdxShellListView

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 ((dxShellListView1.FolderCount = 0) or (dxShellListView1.SelectedItemCount = 0)) then Exit;
  AFolder := dxShellListView1.Folders[dxShellListView1.SelectedItems[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;

#TdxShellTreeView

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;

#Direct TcxShellFolder Class References

The following public API members reference a TcxShellFolder object:

TdxCustomShellListView.Folders
Provides indexed access to displayed shell items.
TdxShellTreeView.Folders
Provides indexed access to displayed shell items.
TcxCustomShellRoot.Folder
Provides access to the folder shell item that corresponds to the current starting location.

#Inheritance

TObject
TcxShellFolder
See Also