Invalid MessageDlg icon with mtConfirmation DlgType constant constant?

In Delphi 10.1.2 Berlin, in the Vcl.Dialogs.MessageDlg function Vcl.Dialogs.MessageDlg the DlgType mtInformation and mtConfirmation create the same dialog icon. For instance:

 if Vcl.Dialogs.MessageDlg('Do you really want to remove the selected item?', mtConfirmation, mbOKCancel, 0) = mrOk then begin RemoveTheSelectedItem; end; 

enter image description here

 if Vcl.Dialogs.MessageDlg('Do you really want to remove the selected item?', mtInformation, mbOKCancel, 0) = mrOk then begin RemoveTheSelectedItem; end; 

enter image description here

But should the DlgType mtConfirmation constant display a question mark icon (how do the other DlgType mtWarning and mtError create each other icon)?

How can I get a question mark icon with the DlgType mtConfirmation constant?

+5
source share
1 answer

The help says:

Confirmation available mtConfirmation Show question mark

Dialog boxes of type TMsgDlgType.mtConfirmation display information icon.

They used to display a question mark instead, but Microsoft removed the question mark symbol from the Windows API function that VCL uses to display the TMsgDlgType.mtConfirmation dialog boxes. Microsoft Quote: β€œThe question mark message icon is no longer recommended because it is clearly not a specific type and because the wording of the message as a question can be applied to any type of message. In addition, users can confuse the message with a question symbol with help information. To use the previous dialog box, you must set the UseLatestCommonDialogs Vcl.Dialogs block variable to False.

So this code:

  Vcl.Dialogs.UseLatestCommonDialogs := False; if Vcl.Dialogs.MessageDlg('Do you really want to remove the selected item?', mtConfirmation, mbOKCancel, 0) = mrOk then begin RemoveTheSelectedItem; end; 

produces this result:

enter image description here

+10
source

Source: https://habr.com/ru/post/1272585/


All Articles