Recent

Author Topic: Information on File Dialogs  (Read 2266 times)

PatBayford

  • Full Member
  • ***
  • Posts: 125
Information on File Dialogs
« on: December 21, 2017, 06:16:22 am »
All of the standard Lazarus dialogs dealing with files have an Event labelled OnChangeFolder, however, this event passes no data regarding the change/s, and there seems to be no simple way of getting this information from the component/s direct. Are any of the esteemed members of this Forum aware of the correct way to implement these events?
Lazarus 1.8.0 FPC 3.0.2 SVN 56594 Windows 10 64bit (i386-win32-win32/win64)

ASerge

  • Hero Member
  • *****
  • Posts: 2477
Re: Information on File Dialogs
« Reply #1 on: December 21, 2017, 07:02:59 am »
All of the standard Lazarus dialogs dealing with files have an Event labelled OnChangeFolder, however, this event passes no data regarding the change/s, and there seems to be no simple way of getting this information from the component/s direct.
For me it's simple
Code: Pascal  [Select][+][-]
  1. procedure TForm1.OpenDialog1FolderChange(Sender: TObject);
  2. begin
  3.   Caption := (Sender as TOpenDialog).FileName;
  4. end;

turrican

  • Full Member
  • ***
  • Posts: 140
  • Pascal is my life.
    • Homepage
Re: Information on File Dialogs
« Reply #2 on: December 21, 2017, 11:19:47 am »
All of the standard Lazarus dialogs dealing with files have an Event labelled OnChangeFolder, however, this event passes no data regarding the change/s, and there seems to be no simple way of getting this information from the component/s direct.
For me it's simple
Code: Pascal  [Select][+][-]
  1. procedure TForm1.OpenDialog1FolderChange(Sender: TObject);
  2. begin
  3.   Caption := (Sender as TOpenDialog).FileName;
  4. end;
As Serge saying, I would like to do in more pessimistic manner :

Code: Pascal  [Select][+][-]
  1.     procedure TForm1.OpenDialog1FolderChange(Sender: TObject);
  2.     begin
  3.       if Sender is TOpenDialog then Caption := TOpenDialog(Sender).Filename;
  4.     end;
  5.  

PatBayford

  • Full Member
  • ***
  • Posts: 125
Re: Information on File Dialogs
« Reply #3 on: December 23, 2017, 01:28:30 am »
Thanks chaps - unable to see the wood for the trees as usual!!!
Lazarus 1.8.0 FPC 3.0.2 SVN 56594 Windows 10 64bit (i386-win32-win32/win64)

 

TinyPortal © 2005-2018