Howto Use TOpenDialog

From Free Pascal wiki
Revision as of 10:41, 6 January 2006 by PeterSieg (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Simple and short guideline:

1. Place the OpenDialog widget on your form (anyplace, since it will be not visible).

  (It is the left most dialog under Dialog)

2. In your code write someting similiar to:


  var filename : string;
  if OpenDialog1.Execute then
  begin
    filename := OpenDialog1.Filename;
    ShowMessage(filename);
  end;


  The method 'Execute' display the file open dialog. returns true when user selects a file,
  false when user aborted.
  The method 'Filename' returns the full filename including drive and path.