ImageEn, unit iexWPD

TIEPortableDevices.ObjectIsFolder

TIEPortableDevices.ObjectIsFolder


Declaration

function ObjectIsFolder(const sObjectID : WideString) : Boolean; overload;
function ObjectIsFolder(Index: Integer): Boolean; overload;


Description

Returns true if the object of the specified ID or index in the objects list is a folder (i.e. ObjectType is iewFolder).

This is the same as calling:
bIsFolder := IEPortableDevices.Objects[ ObjectIDToIndex( sObjectID ) ].ObjectType = iewFolder;


Example

// Open folder on double click
procedure TfrmMain.lbxObjectsDblClick(Sender: TObject);
var
  Idx: Integer;
  aObject: TIEWPDObject;
begin
  if ( lbxObjects.ItemIndex >= 0 ) and
     fPortableDevices.ObjectIsFolder( lbxObjects.Items[ lbxObjects.ItemIndex ] ) then
  begin
    // Fill Objects with items in this folder
    if fPortableDevices.NavigateToFolderID( lbxObjects.Items[ lbxObjects.ItemIndex ] ) then
    begin
      lbxObjects.Items.Clear;
      for I := 0 to fPortableDevices.ObjectCount - 1 do
        lbxObjects.Items.Add( fPortableDevices.Objects[ I ].ID );
    end;
  end;
end;