ATTENTION!! ... We just launched this forum recently, so not much is on it yet. JOIN TODAY!

Open Dialog Code

Everything to do with Lazarus and Free Pscal language
Post Reply
User avatar
PixelinkMedia
Site Admin
Posts: 47
Joined: Mon Apr 08, 2019 2:20 pm
Contact:

Open Dialog Code

Post by PixelinkMedia » Sun May 05, 2019 11:05 am

Pretty basic way to use the Open Dialog component.

1) Drag and drop the TOpenFile (Open File) component from the "Dialogs" tab from the Lazarus IDE

2) Use this code to open the file.
CODE

Code: Select all


procedure TForm6.Button1Click(Sender: TObject);
begin
   if MessageDlg('Open File', Are you sure you want to open a file?', mtConfirmation,
   [mbYes, mbNo],0) = mrYes then
      begin
          OpenDialog1..Filter:='All File Formats (*.*,*.*)|*.*';
          OpenDialog1.Filename:='';
          if OpenDialog1.Execute then
                Memo1.Lines.LoadFromFile(OpenDialog1.Filename)
          else
              {nothing}
      end
   else
      {nothing}


end; 

My Site: Pixelink Media • Windows 7 • 10G RAM • NIV-GForce GT 640 Graphics Card
Affinity (Designer/Photo/ • CorelDraw • Blender • HitFilm • Saola (web animation/interactive) • MagicaVoxel
Lazarus (Free Pascal) • .NET Framework (discontinued for now) • PHP • Html/CSS • Javascript • mySQL/SQLite
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest