stacker_liew 5 Posted July 8, 2022 (edited) From Delphi 10.4, while using MessageDlg with mtConfirmation, the Icon change from Confirm to Info. Here are examples demo. Edited July 8, 2022 by stacker_liew Share this post Link to post
corneliusdavid 220 Posted July 8, 2022 It's not a Delphi thing, it's a Windows thing. I created a small test app that displays messages boxes and can be compiled in multiple versions of Delphi. I tried Delphi 11, 10.4, 10.1, XE2, and XE and on Windows 10 and 11, they all show the same "i" icon for confirmation. Then I pulled up an old virtual machine with Windows 8.1 and recompiled it in Delphi XE (the only version of Delphi I had on that machine) and it showed the good old question mark. Share this post Link to post
stacker_liew 5 Posted July 8, 2022 But I'm using Windows 11, with Delphi 10.3, it's correct, Delphi 10.4, Delphi 11, wrong icon. Share this post Link to post
Uwe Raabe 2063 Posted July 8, 2022 It is even documented: Quote Having mtConfirmation Show a Question Mark Dialog boxes of TMsgDlgType.mtConfirmation type show an information icon. In the past, they used to show a question mark instead, but Microsoft removed the question mark symbol from the Windows API function that the VCL uses to display TMsgDlgType.mtConfirmation dialog boxes. Quoting Microsoft: "The question-mark message icon is no longer recommended because it does not clearly represent a specific type of message and because the phrasing of a message as a question could apply to any message type. In addition, users can confuse the message symbol question mark with Help information." To use the previous dialog box appearance, you must set the UseLatestCommonDialogs variable of the Vcl.Dialogs unit to False. 3 Share this post Link to post
stacker_liew 5 Posted July 8, 2022 2 hours ago, Uwe Raabe said: It is even documented: Let me try...Thanks Share this post Link to post
stacker_liew 5 Posted July 8, 2022 2 minutes ago, stacker_liew said: Let me try...Thanks I just tried, not working. Share this post Link to post
Uwe Raabe 2063 Posted July 8, 2022 Seems that Microsoft has just closed that loophole. Share this post Link to post
stacker_liew 5 Posted July 8, 2022 1 hour ago, Uwe Raabe said: Seems that Microsoft has just closed that loophole. But how come my Delphi 10.3.3 still can use in Windows 11? Share this post Link to post
corneliusdavid 220 Posted July 8, 2022 30 minutes ago, stacker_liew said: But how come my Delphi 10.3.3 still can use in Windows 11? Show us the code that calls this dialog box. Perhaps there's something else we're not understanding about what you're doing. Share this post Link to post
stacker_liew 5 Posted July 8, 2022 1 hour ago, corneliusdavid said: Show us the code that calls this dialog box. Perhaps there's something else we're not understanding about what you're doing. procedure TFireDACDemoForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin case MessageDlg('Ready To Quit?', mtConfirmation, [mbYes, mbNo], 0) of mrYes: CanClose := True; mrNo: CanClose := False; end; end; That's my code. Share this post Link to post
corneliusdavid 220 Posted July 8, 2022 You know, I never asked whether this was VCL or FireMonkey--I just assumed VCL. I just added a FireMonkey app to my simple demo on GitHub and its Confirmation is still a question mark with both Delphi 10.4 and 11. I've attached a screenshot. Share this post Link to post
Uwe Raabe 2063 Posted July 8, 2022 In the later versions Delphi checks for Windows 8+ and uses the MS approach. So the docwiki is outdated and has to be corrected. Share this post Link to post
stacker_liew 5 Posted July 9, 2022 6 hours ago, Uwe Raabe said: In the later versions Delphi checks for Windows 8+ and uses the MS approach. So the docwiki is outdated and has to be corrected. I see. Thanks. Share this post Link to post
stacker_liew 5 Posted July 9, 2022 9 hours ago, corneliusdavid said: You know, I never asked whether this was VCL or FireMonkey--I just assumed VCL. I just added a FireMonkey app to my simple demo on GitHub and its Confirmation is still a question mark with both Delphi 10.4 and 11. I've attached a screenshot. I haven't try with FMX, but I guess FMX is using different approach compare to VCL. Share this post Link to post
haentschman 92 Posted July 10, 2022 Hi...😉 How about using a own TForm as a MessageDlg? ...own design, formatted texts (TStringlist etc.), own icons? 😎 Share this post Link to post
Uwe Raabe 2063 Posted July 10, 2022 Looking at the current VCL implementation it would be little work to show the question mark icon for mtConfirmation. The current behavior is a deliberate decision and probably targeted to match the Windows design. Imagine a user having different icons for confirmation messages depending on the IDE used to compile the program. So I think the message anyone should ask itself: Do I want a look and feel different to the standard Windows one? Share this post Link to post
TonyB 3 Posted July 10, 2022 (edited) Noting the comments above, if I'm asking the user a question that needs an answer, I want a question mark. My fix is to create a descendant of TTaskDialog, put the question mark in a resource file and load it immediately after creating the dialog CustomMainIcon.LoadFromResourceName(HInstance, 'QUESTION_BLUE'); Flags := Flags + [tfUseHIconMain]; See https://docwiki.embarcadero.com/Libraries/Sydney/en/Vcl.Dialogs.TTaskDialog.CustomMainIcon Tony Bryer, Greentram Software Pty Ltd Edited July 10, 2022 by TonyB Share this post Link to post
davornik 4 Posted May 7 Hence I use CreateMessageDialog perhaps you can change Icon it self like this: var Dlg: TForm; ... begin Dlg:=CreateMessageDialog('My Message', mtConfirmation, [mbOk, mbCancel]); //change icon TImage(Dlg.FindComponent('Image')).Picture.Icon.Handle := LoadIcon( 0, IDI_QUESTION); try Result:=Dlg.ShowModal; finally Dlg.Free; end; end; Share this post Link to post