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
> {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
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
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.