Author Topic: TOpenDialog in Windows full functional?  (Read 6215 times)

Giuseppe Ridinò

  • Full Member
  • ***
  • Posts: 130
TOpenDialog in Windows full functional?
« on: June 06, 2004, 12:18:58 am »
I'm getting problems using TOpenDialog in Windows XP.
I use a simple code like that:
Code: [Select]
  openDialog : TOpenDialog;
  openDialog := TOpenDialog.Create(self);
  openDialog.InitialDir := GetCurrentDir;
  openDialog.Options := [ofFileMustExist];
  openDialog.Filter :=
    'Delphi project files|*.dpr|Delphi pascal files|*.pas';
  openDialog.FilterIndex := 2;
  if openDialog.Execute then

It usually works fine, but sometimes the openDialog.Execute command doesn't popup the dialog, thus I can't choose no file, but a message error is shown:
The file "" does not exist. with title File must exist with only one button "Cancel".
Any idea?  :cry:
Is TOpenDialog in Windows full functional?

Giuseppe Ridinò

  • Full Member
  • ***
  • Posts: 130
Walk around
« Reply #1 on: June 06, 2004, 10:49:28 am »
The problem arise when editing a data file in my application and want to load a new one. If data has been modified and not saved, then my application should ask for "Save changes?". Depending on then answer (Yes, No, or Cancel), the OpenDialog is opened to choose the new file.
...  :evil:  ... and here comes the error I described previously!

I noted that Lazarus IDE do it in the reverse mode when loading a new file. It first open the OpenDialog and then later ask for "Save changes?" ... and every thing works fine!  :P
So this is the way I implemented it! :!:


TinyPortal © 2005-2018