Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle



Permlink Replies: 20 - Last Post: Oct 14, 2016 7:38 AM Last Post By: Tom Roberts Threads: [ Previous | Next ]
Hal Burton

Posts: 4
Registered: 4/11/99
TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 20, 2016 10:26 AM
My application is built with Delphi 10 Seattle on Windows 10.
I have encountered an issue with the TSaveDialog component when a custom style is used, any of the Embarcadero custom styles. In the TSaveDialog I have the ofOverwritePrompt option set. When I try to save to an existing file the overwrite prompt dialog box is not displayed properly. Only the top left corner is visible, about 30 x 60 pixels, so the text and buttons are not visible, in fact most users would not even notice it on the screen. The dialog is still active so pressing the spacebar clicks the default NO button and closes the dialog.
if I set the Style back to the default Windows style, the overwrite prompt displays properly.
I did find a workaround. By removing the shDialogs flag from the TStyleManager,SystemHooks property the overwrite prompt dialog displays properly when using custom Styles.
I believe this is a bug in the Seattle version that needs to be corrected. I have been using custom styles since the XE3 version and never encountered this issue until upgrading to Seattle Update 1.
Another oddity...
On my Windows 10 development machine the overwrite prompt dialog displays properly with custom styles without the workaround.
Running the same executable on my test client machine, the overwrite prompt dialog shows only the upper left corner. With the workaround applied the overwrite prompt displays properly.
This makes me wonder if there is some distributable files required for the custom styles with Seattle?
I've never had to distribute any files to use custom style in previous versions.

Edited by: Hal Burton on Jan 22, 2016 6:47 PM
F.James Rohlf

Posts: 4
Registered: 9/22/99
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 25, 2016 6:50 PM   in response to: Hal Burton in response to: Hal Burton
I just encountered the same problem. Not a problem previously. Perhaps some Windows 10 update causes a problem. I have not recently updated Delphi. I am sure it worked fine a few weeks ago.

P.S. I just installed update 1 for Delphi 10 and have the same problem. It is rather embarrassing to release software with this problem!

Jim
Hal Burton wrote:
My application is built with Delphi 10 Seattle on Windows 10.
I have encountered an issue with the TSaveDialog component when a custom style is used, any of the Embarcadero custom styles. In the TSaveDialog I have the ofOverwritePrompt option set. When I try to save to an existing file the overwrite prompt dialog box is not displayed properly. Only the top left corner is visible, about 30 x 60 pixels, so the text and buttons are not visible, in fact most users would not even notice it on the screen. The dialog is still active so pressing the spacebar clicks the default NO button and closes the dialog.
if I set the Style back to the default Windows style, the overwrite prompt displays properly.
I did find a workaround. By removing the shDialogs flag from the TStyleManager,SystemHooks property the overwrite prompt dialog displays properly when using custom Styles.
I believe this is a bug in the Seattle version that needs to be corrected. I have been using custom styles since the XE3 version and never encountered this issue until upgrading to Seattle Update 1.
Another oddity...
On my Windows 10 development machine the overwrite prompt dialog displays properly with custom styles without the workaround.
Running the same executable on my test client machine, the overwrite prompt dialog shows only the upper left corner. With the workaround applied the overwrite prompt displays properly.
This makes me wonder if there is some distributable files required for the custom styles with Seattle?
I've never had to distribute any files to use custom style in previous versions.

Edited by: Hal Burton on Jan 22, 2016 6:47 PM

Edited by: F.James Rohlf on Jan 25, 2016 10:20 PM
Michael Whittin...

Posts: 2
Registered: 2/23/01
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 13, 2016 10:44 AM   in response to: Hal Burton in response to: Hal Burton
Did you enter a bug report for this? It is definitely a problem.
F.James Rohlf

Posts: 4
Registered: 9/22/99
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 13, 2016 7:58 PM   in response to: Michael Whittin... in response to: Michael Whittin...
No, I did not. I have not done that before. Not sure of the procedure.

Michael Whittingham wrote:
Did you enter a bug report for this? It is definitely a problem.
Peter Below

Posts: 1,227
Registered: 12/16/99
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 14, 2016 3:50 AM   in response to: F.James Rohlf in response to: F.James Rohlf
F.James Rohlf wrote:

No, I did not. I have not done that before. Not sure of the procedure.

Michael Whittingham wrote:
Did you enter a bug report for this? It is definitely a problem.

Go to https://quality.embarcadero.com . Log in using the EDN account
you used to register your Delphi/RAD Studio. The rest should be fairly
self-explanatory.

--
Peter Below
TeamB

Hal Burton

Posts: 4
Registered: 4/11/99
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 14, 2016 7:14 AM   in response to: F.James Rohlf in response to: F.James Rohlf
I have not submitted a bug report either. If you have, or will be submitting a bug report I will stay out if it. If you are not submitting the bug report then I will.

F.James Rohlf wrote:
No, I did not. I have not done that before. Not sure of the procedure.

Michael Whittingham wrote:
Did you enter a bug report for this? It is definitely a problem.
F.James Rohlf

Posts: 4
Registered: 9/22/99
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 14, 2016 9:50 AM   in response to: Hal Burton in response to: Hal Burton
I just submitted a report.

Hal Burton wrote:
I have not submitted a bug report either. If you have, or will be submitting a bug report I will stay out if it. If you are not submitting the bug report then I will.

F.James Rohlf wrote:
No, I did not. I have not done that before. Not sure of the procedure.

Michael Whittingham wrote:
Did you enter a bug report for this? It is definitely a problem.
Hal Burton

Posts: 4
Registered: 4/11/99
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 14, 2016 2:16 PM   in response to: F.James Rohlf in response to: F.James Rohlf
Thanks James.

F.James Rohlf wrote:
I just submitted a report.

Hal Burton wrote:
I have not submitted a bug report either. If you have, or will be submitting a bug report I will stay out if it. If you are not submitting the bug report then I will.

F.James Rohlf wrote:
No, I did not. I have not done that before. Not sure of the procedure.

Michael Whittingham wrote:
Did you enter a bug report for this? It is definitely a problem.
Carl Olsen

Posts: 124
Registered: 3/29/00
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 23, 2016 2:50 PM   in response to: Hal Burton in response to: Hal Burton
Here is a link to the Quality Central bug report on this one, in case anyone cares to vote it up, or see other discussion :)

https://quality.embarcadero.com/browse/RSP-13720?jql=text%20~%20%22TSaveDialog%22

Edited by: Carl Olsen on Jun 23, 2016 2:51 PM
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10Seattle [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 23, 2016 4:02 PM   in response to: Carl Olsen in response to: Carl Olsen
Carl wrote:

Here is a link to the Quality Central bug report on this one

You mean Quality Portal instead, since Quality Central is deprecated.

--
Remy Lebeau (TeamB)
Carl Olsen

Posts: 124
Registered: 3/29/00
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10Seattle [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 23, 2016 4:06 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
You mean Quality Portal instead, since Quality Central is deprecated.
Remy Lebeau (TeamB)

LOL - I get enough "is deprecated" compiler warnings already. Now I'm even getting them in the forums! :)
Jason Sweby

Posts: 46
Registered: 5/20/00
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 31, 2016 1:34 AM   in response to: Hal Burton in response to: Hal Burton
I had the same recently and,a after a day, traced it to the manifest settings. I was using a custom manifest. Even changing this to Auto Generate didn't work until I ticked the "Enable High-DPI" option, then it worked on Windows 10.

There is a closed QC item on this: RSP-12942. It needs to be reopened as I believe it remains an issue in 10.1 Berlin.
Robert Deuerling

Posts: 1
Registered: 3/3/14
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 27, 2016 11:37 AM   in response to: Jason Sweby in response to: Jason Sweby
Jason Sweby wrote:
I had the same recently and,a after a day, traced it to the manifest settings. I was using a custom manifest. Even changing this to Auto Generate didn't work until I ticked the "Enable High-DPI" option, then it worked on Windows 10.

There is a closed QC item on this: RSP-12942. It needs to be reopened as I believe it remains an issue in 10.1 Berlin.

Today i installed Delphi Berlin 10.1 Update 1 on Windows 10 Aniversary Update (Version 1607)
The issue still exists in Berlin Prof, even if you enable High-DPI von VCL
franck clement

Posts: 9
Registered: 6/18/12
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 1, 2016 12:57 AM   in response to: Robert Deuerling in response to: Robert Deuerling
Same problem for me, I have Berlin 10.1 with Update 1 on Windows 10.

Who has solved this problem ???
This is very annoying !

Thanks
Franck
Carl Olsen

Posts: 124
Registered: 3/29/00
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 1, 2016 2:13 PM   in response to: franck clement in response to: franck clement
Who has solved this problem ???
This is very annoying !

I posted a work-around about 5 messages down in the bug report here:

https://quality.embarcadero.com/browse/RSP-13720?jql=text%20~%20%22TSaveDialog%22

It has worked well enough for me, at least.
franck clement

Posts: 9
Registered: 6/18/12
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 2, 2016 2:55 AM   in response to: Carl Olsen in response to: Carl Olsen
Thanks a lot Carl,

I've tried this in the OnCreate of the form and it works:

if TStyleManager.IsCustomStyleActive then
begin
TStyleManager.SystemHooks := TStyleManager.SystemHooks - [shDialogs]
end;

Many thanks !

Franck

Tom Roberts

Posts: 102
Registered: 6/21/05
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10 Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 13, 2016 6:37 AM   in response to: franck clement in response to: franck clement
I've tried this in the OnCreate of the form and it works:

if TStyleManager.IsCustomStyleActive then
begin
TStyleManager.SystemHooks := TStyleManager.SystemHooks - [shDialogs]
end;

Many thanks !

Franck


I'm having the same problem with the TSaveDialog. Could anyone kindly give me the c++ builder translation of the above code?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 13, 2016 11:48 AM   in response to: Tom Roberts in response to: Tom Roberts
Tom wrote:

Could anyone kindly give me the c++ builder translation
of the above code?

if (TStyleManager::IsCustomStyleActive)
{
    TStyleManager::SystemHooks = TStyleManager::SystemHooks >> TSystemHook::shDialogs;
}


--
Remy Lebeau (TeamB)
Tom Roberts

Posts: 102
Registered: 6/21/05
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 14, 2016 1:08 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Thanks Remy and Franck. I couldn't look up Carl's contribution as the bug link isn't working.
Carl Olsen

Posts: 124
Registered: 3/29/00
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 14, 2016 7:01 AM   in response to: Tom Roberts in response to: Tom Roberts
Tom Roberts wrote:
Thanks Remy and Franck. I couldn't look up Carl's contribution as the bug link isn't working.

Here is the routine I'm using, that I posted to the bug report, posted here for convenience. Be sure to read the comment at the very bottom for an optional way of doing things.


function ThemeSafeLaunchSaveDialog(SaveDialog:TSaveDialog):Boolean;
{
  @@@@@@ This is a wrapper function for SaveDialog.Execute, in order
  to work around a bug in Delphi @@@@@.
 
  This "fixes" a bug in Delphi XE10 (and possibly other versions) where if
  a VCLStyle is active the TSaveDialogs with the ofOverwritePrompt enabled
  will lock up when it asks the user to overwrite a file.  (Actually it does
  not lock up exactly, but instead displays the "Do you want to replace it?"
  prompt all tiny and scrunched up so the user can't click on the response
  buttons.
 
  This fix prevents that from happening.
 
  To use this routine, replace code like this:
 
    Result:=MySaveDialog.Execute;
 
  ...with code like this:
 
    Result:=ThemeSafeLaunchSaveDialog(MySaveDialog);
 
  For info on this bug, see:
 
    https://quality.embarcadero.com/browse/RSP-13720?jql=text%20~%20%22TSaveDialog%22
    https://forums.embarcadero.com/thread.jspa;jsessionid=5A34E74989CC46CCE41C5022E40935F5?messageID=772902
}
var
  OldOverwriteValue,DoneFlag:Boolean;
resourcestring
  sOverwriteOK1='%s already exists.';
  sOverwriteOK2='Do you want to replace it?';
begin
 
  {See if Overwrite flag was set.}
  OldOverWriteValue:=ofOverwritePrompt in SaveDialog.Options;
 
  {If the overwrite flag was not set, or if theming is not enabled,
   then just call the standard dialog as normal, since there is no Delphi bug
   to fix here.}
  if (OldOverwriteValue=False) or (TStyleManager.IsCustomStyleActive=False) then
  begin
    Result:=SaveDialog.Execute();
    exit;
  end;
 
  {If the overwrite flag was set, and we are theming, then remove that flag,
   so we can handle this condition ourselves.}
  SaveDialog.Options:=SaveDialog.Options-[ofOverwritePrompt];
 
  {Launch the dialog.}
  Result:=SaveDialog.Execute();
 
  {If the dialog was not canceled, but the file exists, then ask user if they want to overwrite.}
  if (Result=True) and FileExists(SaveDialog.FileName) then
  begin
    {Loop until either the user cancels out, or accepts the overwrite option.}
    DoneFlag:=False;
    While DoneFlag=False do
    begin
      {Prompt for overwrite.}
      if MessageDlg(Format(sOverwriteOK1,[SaveDialog.FileName])+#13+#13+sOverwriteOK2,
                    mtWarning,[mbYes,mbNo],0,mbNo)=mrYes then
      begin
        {User says okay to overwrite, so move on.}
        DoneFlag:=True;
      end
      else
      begin
        {User did not want to overwrite, so return back to dialog.}
        SaveDialog.FileName:='';       // Clear out the file name to match normal TSaveDialog behavior.
        Result:=SaveDialog.Execute();  // Re-display the dialog.
        if Result=False then
        begin
          {User canceled the dialog, so we are done here}
          DoneFlag:=True;
        end;
      end;
    end;
  end;
 
  {Restore the Overwrite value back to the dialog.}
  SaveDialog.Options:=SaveDialog.Options+[ofOverwritePrompt];
 
  {Note: An option here instead of all the mess above, is to simply disable
         themes for the dialog completely.  That can be accomplished with the
         code below, but of course the dialog is no longer themed and will clash
         with the rest of the software.
 
         HadHook:=(shDialogs in TStyleManager.SystemHooks);
         if TStyleManager.IsCustomStyleActive then TStyleManager.SystemHooks := TStyleManager.SystemHooks - [shDialogs];
         Result:=SaveDialog.Execute();
         if HadHook then TStyleManager.SystemHooks := TStyleManager.SystemHooks + [shDialogs]
  }
 
end;
 
Procedure FixStyledSaveDialogOverwritePrompt;
begin
  {@@@@@@ This is a Delphi Bug Fix.   Basically, if a Style is active, then
   TSaveDialogs go goofy when asking to overwrite an existing file, where the
   prompt for that appears as a tiny shrunk message that locks up the user's
   PC.  This fix prevents that from happening.
   See: https://forums.embarcadero.com/thread.jspa;jsessionid=5A34E74989CC46CCE41C5022E40935F5?messageID=772902
   @@@@@@}
  if TStyleManager.IsCustomStyleActive then TStyleManager.SystemHooks := TStyleManager.SystemHooks - [shDialogs]
end;
 
Tom Roberts

Posts: 102
Registered: 6/21/05
Re: TSaveDialog overwrite prompt dialog error with Styles in Delphi 10Seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 14, 2016 7:38 AM   in response to: Carl Olsen in response to: Carl Olsen
Thanks Carl.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02