Difference between revisions of "Howto Use TOpenDialog"

From Lazarus wiki
Jump to navigationJump to search
Line 24: Line 24:
  
 
The [[doc:lcl/dialogs/tfiledialog.filename.html | Filename]] property returns the full filename including drive and path.
 
The [[doc:lcl/dialogs/tfiledialog.filename.html | Filename]] property returns the full filename including drive and path.
 +
 +
 +
== See also ==
 +
 +
* [[Howto Use TSaveDialog]]
 +
* [[Dialogs_tab#TSaveDialog| TOpenDialog]]

Revision as of 08:10, 3 July 2008

Deutsch (de) English (en) español (es) suomi (fi) français (fr) 日本語 (ja) polski (pl) русский (ru) slovenčina (sk)

Simple and short guideline:

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

  Component Palette Dialogs.png
 
  (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 Execute method displays the file open dialog. It returns true when user has selected a file, false when user has aborted.

The Filename property returns the full filename including drive and path.


See also