Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another OpenDialog question. No Dialog displayed

Status
Not open for further replies.

sggaunt

Programmer
Jul 4, 2001
8,620
GB
Using Delphi 7

I am starting to run D7 under Vista, but as I say I am not sure if this has anything to do with the problem.
But I think I have seen this before, but cannot remember what causes it.

My application looks for required files with IfFileExists then launchs an OpenDialog if they are not found.
The first instance of this works fine. but at the second instance the dialog does not appear, and the application hangs at that point, as if the dialog has opened but is not visible. hmmm

I should bring the actual code but both instances use the fomat..
Code:
with dialogname do
   if execute then
      begin
      end;
fairly standard stuff?


Steve: N.M.N.F.
Playing the blues isn't about feeling better. It's about making other people feel worse.
 
Is dialogname a visual component?
If so, maybe creating it at runtime?

Hope this helps,

Rej Cloutier
 
Have you considered forcing it to re-initialize all of the initial values?
Code:
  with OpenDialog1 do       //just for Rej
  begin
    DefaultExt:= MyDefaultExt;
    Filter:= MyFilter;
    InitialDirectory:= MyInitialDirectory;
    if Execute then 
    begin
      DoMyStuff
    end;
  end;

Roo
Delphi Rules!
 
Cheers guys, but I don't think the problem lies with the dialogs.
I made a test app that opens 2 dialogs consequtively with no setup done. and its fine.

I believe there is some problem with the project as a whole, perhaps caused by mis-beahving third party components?

It is the same under XP, once I have the file names pointing to the right places I don't see the problem, but its still there.

Also the Vista install started crashing horribly when attempting to open this project, I think I have seen something similar with the XP install?

In Vista I got (on starting Delphi after closing with this project desktop saved) a dialog that says 'No Disk' in the border and just some long numbers in the body, Comes back on any option [Close, Ignore, Continue] but if you keep clicking it eventually goes away and the project seems to load normally.

I don't even know if this is a Windows or a Delphi Error.

This morning I tried it and it loaded normally. Grrr







Steve: N.M.N.F.
Playing the blues isn't about feeling better. It's about making other people feel worse.
 
It really sounds like something is changing the current drive and/or folder in your app before your call to OpenDialog, which was why I suggested the init before every call. You could try System.GetDir() beforehand, which will tell you what it is without raising an exception even if it is indeed invalid.

If it is invalid, I'd use System.ChDir() as early in your app as possible to set it straight.

Roo
Delphi Rules!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top