Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

File extensions in TelShellList

I have found that when the user does not display the known file extensions in Windows explorer, the TelShellList also hides those extensions. 

No problem with this.  However, when I try to read the selected items in it, I only get the file name without the file extension.  How can I get the selected filename along with its extension?

Is there a property that I need to set or a function that will return the filename along with the extension?

Comments

  • 5 Comments sorted by Votes Date Added
  • Use item's FullName property, which is in case of file items will return full path to the file:

    s := ElShellList1.ItemFocused.FullName;
  • It does exists for ItemFocused, but when I try to go through the list of selected file items, the FullName does not exists.

       tiFile := ElShellList1.GetNextSelected(nil);
       while Assigned(tiFile) do  begin
            sFileName := tiFile.Caption;   ?????
            tiFile := DFileList.GetNextSelected(tiFile);
       end;





  • I noticed that the FocusedItem is of type TElShellListItem, but the TElShellList.Items, and TElShellList.Selected are TElTreeItem, not TElShellListItem, so they do not have the FullName property.

    So my guess is that the only way to get the FullName of all selected items would be to typecast all the selected TelTreeItem as as TElShellListItem. 

    It would make more sense to have access to this property for all items in the TelShellListItem.  No?





  • Yes, you have to cast item to TElShellListItem.
  • Not an obvious solution (without looking at your source code).The fact that TElShellList.Items are not TElShellListItem is confusing. It would make more sense to make all items of a TElShellList TElShellListItem. 
Sign In or Register to comment.