Mega Search
23.2 Million


Sign Up

Make a donation  
Opendialog error in IDE and Delphi XE  
News Group: embarcadero.public.delphi.ide

Hi,
I have observed several times now that when calling an opendialog in Delphi XE from the IDE the program fails.  The executable directly works fine and this code has also worked fine in Delphi 2006, from the IDE.

Has anything changed that I should be aware of?  I am running Delphi XE and Windows 7 (32 bit)

{code}
  FName := '';
  OdMyData.InitialDir := ApplicationRootPath;
  try
    if OdMyData.Execute then
      FName := OdMyData.FileName;
    if FName <> '' then
      edIconPath.text := FName;
  finally
    imgIcon.Picture.Bitmap.LoadFromFile(FName);
  end;
{code}
Thanks

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 20-Jun-2011, at 8:55 AM EST
From: Bennie Coetzer
 
Re: Opendialog error in IDE and Delphi XE  
News Group: embarcadero.public.delphi.ide
> {quote:title=Bennie Coetzer wrote:}{quote}
> I have observed several times now that when calling an opendialog in Delphi XE from the IDE the program fails.  The executable directly works fine and this code has also worked fine in Delphi 2006, from the IDE.
> Has anything changed that I should be aware of?  I am running Delphi XE and Windows 7 (32 bit)
> 
> {code}
>   FName := '';
>   OdMyData.InitialDir := ApplicationRootPath;
>   try
>     if OdMyData.Execute then
>       FName := OdMyData.FileName;
>     if FName <> '' then
>       edIconPath.text := FName;
>   finally
>     imgIcon.Picture.Bitmap.LoadFromFile(FName);
>   end;
> {code}

Your "finally" section will be called to load an image even when you may not have specified one with the openfiledialog (FName is still blank, you cancelled the dialog). Why?
--
Mark Jacobs
www.dkcomputing.co.uk

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 21-Jun-2011, at 6:18 AM EST
From: Mark Jacobs
 
Re: Opendialog error in IDE and Delphi XE [Edit]  
News Group: embarcadero.public.delphi.ide
I am experiencing a similar problem with Delphi XE running on Windows 7. 

Under the compatabilty options in the properties of the shortcut to launch Delphi XE I have disabled the visual themes. Since doing this the Open and Save As dialogs do nothing in the Delphi IDE.  

I disabled the visual themes so that the form designer would no longer use my windows theme when displaying the forms... I want to see the forms in the designer with the controls showing the colour set in the control's property and not being overridden by the colour from my windows theme.

Edited by: Andrew Grant on Aug 17, 2011 7:03 PM

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 17-Aug-2011, at 10:04 PM EST
From: Andrew Grant
 
Re: Opendialog error in IDE and Delphi XE [Edit]  
News Group: embarcadero.public.delphi.ide
Here's the problem: TOpenDialog.Execute fails, generating a "XXX application file has stopped working" window, with only one "Close Program" button. The problem only happens when debugging the program inside the IDE.

I found the problem happens when the Windows Aero Glass interface is OFF: 
Control Panel / All Control Panel Items / Personalization / Windows 7 BASIC

Turning Aero back on fixes the problem:
Control Panel / All Control Panel Items / Personalization / Windows 7

I'm using Windows 7, 64-bit, Delphi 2010, Update 5.

Edited by: David Eisler on Dec 18, 2011 10:21 AM

Never mind, the fix didn't stick.

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 18-Dec-2011, at 2:21 PM EST
From: David Eisler