treeview

How can you detect if the selected text in a treeview is an directory or an file ?
Thanks

Comments

  • : How can you detect if the selected text in a treeview is an directory or an file ?
    : Thanks
    :
    :
    Using only the caption itself, this requires looking at the file structure on the disk. In most file-treeviews directories and files have different icons, or the programmer used the Data property of the TTreeNode to store additional info about the node. In this case you can simply check that to distinguish between the two.
  • : : How can you detect if the selected text in a treeview is an directory or an file ?
    : : Thanks
    : :
    : :
    : Using only the caption itself, this requires looking at the file structure on the disk. In most file-treeviews directories and files have different icons, or the programmer used the Data property of the TTreeNode to store additional info about the node. In this case you can simply check that to distinguish between the two.
    :
    Ok Thanks
  • : : How can you detect if the selected text in a treeview is an directory or an file ?
    : : Thanks
    : :
    : :
    : Using only the caption itself, this requires looking at the file structure on the disk. In most file-treeviews directories and files have different icons, or the programmer used the Data property of the TTreeNode to store additional info about the node. In this case you can simply check that to distinguish between the two.
    :


    I was wondering if it its possible to use the dot to detect if its an file or directory this should be possible right ? file has an dot . directorys not.. if treeview1.selected.text has char . then begin
    can you give an example how i can do this ? Thanks a lot

  • : : : How can you detect if the selected text in a treeview is an directory or an file ?
    : : : Thanks
    : : :
    : : :
    : : Using only the caption itself, this requires looking at the file structure on the disk. In most file-treeviews directories and files have different icons, or the programmer used the Data property of the TTreeNode to store additional info about the node. In this case you can simply check that to distinguish between the two.
    : :
    :
    :
    : I was wondering if it its possible to use the dot to detect if its an file or directory this should be possible right ? file has an dot . directorys not.. if treeview1.selected.text has char . then begin
    : can you give an example how i can do this ? Thanks a lot
    :
    :
    Directories can have dots in their names. For example: "data.lst" is a valid directory name. In this case the directory will be detected as a file.
    You can use the Pos() function to detect if a certain (group of) letter(s) is present in a string. The help file description of this function describes the details.
  • : : : : How can you detect if the selected text in a treeview is an directory or an file ?
    : : : : Thanks
    : : : :
    : : : :
    : : : Using only the caption itself, this requires looking at the file structure on the disk. In most file-treeviews directories and files have different icons, or the programmer used the Data property of the TTreeNode to store additional info about the node. In this case you can simply check that to distinguish between the two.
    : : :
    : :
    : :
    : : I was wondering if it its possible to use the dot to detect if its an file or directory this should be possible right ? file has an dot . directorys not.. if treeview1.selected.text has char . then begin
    : : can you give an example how i can do this ? Thanks a lot
    : :
    : :
    : Directories can have dots in their names. For example: "data.lst" is a valid directory name. In this case the directory will be detected as a file.
    : You can use the Pos() function to detect if a certain (group of) letter(s) is present in a string. The help file description of this function describes the details.
    :
    Thanks i am going to read about the Pos function

  • TRY TO USE THE FUNCTION "DirectoryExists", Unit SysUtils.

    function DirectoryExists(const Directory: string): Boolean;



    : : : : : How can you detect if the selected text in a treeview is an directory or an file ?
    : : : : : Thanks
    : : : : :
    : : : : :
    : : : : Using only the caption itself, this requires looking at the file structure on the disk. In most file-treeviews directories and files have different icons, or the programmer used the Data property of the TTreeNode to store additional info about the node. In this case you can simply check that to distinguish between the two.
    : : : :
    : : :
    : : :
    : : : I was wondering if it its possible to use the dot to detect if its an file or directory this should be possible right ? file has an dot . directorys not.. if treeview1.selected.text has char . then begin
    : : : can you give an example how i can do this ? Thanks a lot
    : : :
    : : :
    : : Directories can have dots in their names. For example: "data.lst" is a valid directory name. In this case the directory will be detected as a file.
    : : You can use the Pos() function to detect if a certain (group of) letter(s) is present in a string. The help file description of this function describes the details.
    : :
    : Thanks i am going to read about the Pos function
    :

  • Hi!

    Here is a sample code just for additon of the prior posts

    [code]
    function TForm1.GetTreeViewPath(node: TTreeNode): string;
    begin
    // this recursive function return the path of the treevew
    result := '';
    if node<>nil then result := GetTreeViewPath(node.Parent)+node.Text+'';
    end;

    procedure TForm1.TreeView1Click(Sender: TObject);
    begin

    // Check if directoy exists, when user clicks on the treeview
    if DirectoryExists(GetTreeViewPath(TreeView1.Selected)) then
    SHowMessage('Directory exists')
    else
    SHowMessage('Directory does not exists');

    end;


    [/code]

    :
    : TRY TO USE THE FUNCTION "DirectoryExists", Unit SysUtils.
    :
    : function DirectoryExists(const Directory: string): Boolean;
    :
    :
    :
    : : : : : : How can you detect if the selected text in a treeview is an directory or an file ?
    : : : : : : Thanks
    : : : : : :
    : : : : : :
    : : : : : Using only the caption itself, this requires looking at the file structure on the disk. In most file-treeviews directories and files have different icons, or the programmer used the Data property of the TTreeNode to store additional info about the node. In this case you can simply check that to distinguish between the two.
    : : : : :
    : : : :
    : : : :
    : : : : I was wondering if it its possible to use the dot to detect if its an file or directory this should be possible right ? file has an dot . directorys not.. if treeview1.selected.text has char . then begin
    : : : : can you give an example how i can do this ? Thanks a lot
    : : : :
    : : : :
    : : : Directories can have dots in their names. For example: "data.lst" is a valid directory name. In this case the directory will be detected as a file.
    : : : You can use the Pos() function to detect if a certain (group of) letter(s) is present in a string. The help file description of this function describes the details.
    : : :
    : : Thanks i am going to read about the Pos function
    : :
    :
    :
    \///
    /O O
    | | |
    | _ |
    ___/
    SoftMan

  • Quite good directory treeview tool called [link=http://www.print-directory.com]print directory[/link] not a freeware but affortable.
Sign In or Register to comment.

Howdy, Stranger!

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

Categories