RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TDirectoryListBox.GetItemPath Method

Returns the path of a directory in the directory list box.

Pascal
function GetItemPath(Index: Integer): string;
C++
__fastcall AnsiString GetItemPath(int Index);

Use GetItemPath to get the path of a directory by specifying the directory's index value. The first directory in the list has an index of 0.  

C++ Examples: 

 

/*
This example uses a directory list box, a button, and a
label on a form. When the user selects a directory in the
directory list box and clicks the button, the selected
directory opens, and the path of the second directory
displayed in the list box appears as the caption of the
label.
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  DirectoryListBox1->OpenCurrent();
  Label1->Caption = DirectoryListBox1->GetItemPath(1);
}

 

Delphi Examples: 

{
This example uses a directory list box, a button, and a
label on a form. When the user selects a directory in the
directory list box and clicks the button, the selected
directory opens, and the path of the second directory
displayed in the list box appears as the caption of the
label.
} 
procedure TForm1.Button1Click(Sender: TObject);
begin
  DirectoryListBox1.OpenCurrent;
  Label1.Caption := DirectoryListBox1.GetItemPath(1);
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!