RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TOpenDialog.Title Property

Specifies the text in the dialog's title bar.

Pascal
property Title: string;
C++
__property AnsiString Title;

Use Title to specify the text that appears in the file-selection dialog's title bar. If no value is assigned to Title, the dialog has the title "Open".  

C++ Examples: 

 

/*
Click the button to open a TOpenDialog, then select a file 
to delete.
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  OpenDialog1->Title = "Delete File";
  if (OpenDialog1->Execute())
  {
    if (FileExists(OpenDialog1->FileName))
      DeleteFile(OpenDialog1->FileName);
  }
}

 

Delphi Examples: 

{
Click the button to open a TOpenDialog, then select a file 
to delete.
}

procedure TForm1.Button1Click(Sender: TObject);
var
  F: Textfile;
begin
  OpenDialog1.Title := 'Delete File';
  if OpenDialog1.Execute then
  begin
    AssignFile(F, OpenDialog1.FileName);
    try
      Reset(F);
      if MessageDlg('Erase ' + OpenDialog1.FileName + '?',
        mtConfirmation, [mbYes, mbNo], 0) = mrYes then
      begin
        CloseFile(F);
        Erase(F);
      end;
    except
      on EInOutError do
        MessageDlg('File I/O error.', mtError, [mbOk], 0);
    end;
  end;
end;

 

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