RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TFileListBox.ApplyFilePath Method

Updates the file list box to represent a fully qualified file name.

Pascal
procedure ApplyFilePath(const EditText: string); virtual;
C++
virtual __fastcall ApplyFilePath(const AnsiString EditText);

Call ApplyFilePath to change the Directory, Drive, FileName, and Mask properties so that they match the values implied by the EditText parameter. For example, if an edit control is linked to the file list box using the FileEdit property, call ApplyFilePath from the OnChange event handler of the edit control to update the file list box whenever the user types a value in the edit control. 

ApplyFilePath updates the Mask property only if the EditText parameter includes wildcards. If the form contains a TDirectoryListBox object that specifies this file list box object in its FileList property, the Directory and Drive properties of the directory list box object are updated as well. If the form also includes a TDriveComboBox object that specifies the directory list box in its DirList property, the Drive property of the drive combo box will also be updated. However, the Mask property of any TFilterComboBox will not be updated.  

C++ Examples: 

 

/*
This example uses a file list box, a directory list box, a
filter combo box, a drive combo box, a label, an edit box,
and a button on a form. When the user runs the application
and enters a path or filename in the edit box and presses
the button, all the controls update:
*/
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  FileListBox1->FileEdit = Edit1;
  FilterComboBox1->FileList = FileListBox1;
  DirectoryListBox1->FileList = FileListBox1;
  DirectoryListBox1->DirLabel = Label1;
  DriveComboBox1->DirList = DirectoryListBox1;
  Button1->Default = true;
}

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  FileListBox1->ApplyFilePath(Edit1->Text);
}

 

Delphi Examples: 

{
This example uses a file list box, a directory list box, a
filter combo box, a drive combo box, a label, an edit box,
and a button on a form. When the user runs the application
and enters a path or filename in the edit box and presses
the button, all the controls update:
} 
procedure TForm1.Button1Click(Sender: TObject);
begin
  FileListBox1.ApplyFilePath(Edit1.Text);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  FileListBox1.FileEdit := Edit1;
  FilterComboBox1.FileList := FileListBox1;
  DirectoryListBox1.FileList := FileListBox1;
  DirectoryListBox1.DirLabel := Label1;
  DriveComboBox1.DirList := DirectoryListBox1;
  Button1.Default := True;
end;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!