jesu 0 Posted March 13 Hello This code: if MessageDlg('Welcome to my Delphi application. Exit now?', mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes then begin MessageDlg('Exiting the Delphi application.', mtInformation, [mbOk], 0, mbOk); Close; end; shows icons in previous versions, but not in Delphi 12. This is too obvious to be a bug. Am I missing something? Thanks. Share this post Link to post
PeterBelow 231 Posted March 13 4 hours ago, jesu said: Hello This code: if MessageDlg('Welcome to my Delphi application. Exit now?', mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes then begin MessageDlg('Exiting the Delphi application.', mtInformation, [mbOk], 0, mbOk); Close; end; shows icons in previous versions, but not in Delphi 12. This is too obvious to be a bug. Am I missing something? Thanks. This has come up before. Microsoft changed the UI guidelines and now recommends to not show an icon for confirmation dialogs. D12's vcl.dialogs unit was modied accordingly. Share this post Link to post
DelphiUdIT 145 Posted March 13 (edited) UseLatestCommonDialogs: Boolean = True; MsgDlgIcons: array[TMsgDlgType] of TMsgDlgIcon = (TMsgDlgIcon.mdiWarning, TMsgDlgIcon.mdiError, TMsgDlgIcon.mdiNone, TMsgDlgIcon.mdiNone, TMsgDlgIcon.mdiNone); This is how they delete the standard dialogs (MessageBox) icons, except for Warning and Error. Edited March 13 by DelphiUdIT Share this post Link to post
jesu 0 Posted March 15 Any way to restore the previous behaviour? That's what users have seen for many years and what they expect Share this post Link to post
Lajos Juhász 270 Posted March 15 MsgDlgIcons[TMsgDlgType.mtInformation]:=TMsgDlgIcon.mdiInformation; MessageDlg('Exiting the Delphi application.', mtInformation, [mbOk], 0, mbOk); You have to System.UITypes into the uses. 1 Share this post Link to post
afturk 0 Posted July 25 please excuse my English. but I didn't understand how did you solve it. I added System.UITypes to the uses section of the relevant forms but where was the code added to System.UITypes.pas. I can't find this part MsgDlgIcons[TMsgDlgType.mtInformation]:=TMsgDlgIcon.mdiInformation; I couldn't find where to add this part In System.UITypes.pas { Message dialog } TMsgDlgType = (mtWarning, mtError, mtInformation, mtConfirmation, mtCustom); TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, mbAll, mbNoToAll, mbYesToAll, mbHelp, mbClose); TMsgDlgButtons = set of TMsgDlgBtn; TMsgDlgIcon = (mdiNone, mdiWarning, mdiError, mdiInformation, mdiShield); can you help Share this post Link to post
Lajos Juhász 270 Posted July 25 MsgDlgIcons is a global variable (array) defined in VCL.Dialogs. As with any global variables there is no guarantee that somebody somewhere in the code will not change the value (searching in VCL it is a "constant variable"). If you are sure that no library you are using is not changing the value of the array you can safely change somewhere where you initialize your application. Share this post Link to post
afturk 0 Posted July 25 I am unable to display the mtInformation icon. Delphi, where exactly do you suggest making changes to fix this? I couldn't find it either. What I really want to ask is, what can I do to ensure that the MessageDlg('test', TMsgDlgType.mtInformation, mbYesNo, 0) displays the icon? I don't understand which parts to change if it's not in VCL.Dialogs or System.UITypes. I'm new to Delphi. Share this post Link to post
Lajos Juhász 270 Posted July 25 Create a new VCL application. Double click on the form to create the formcreate method and add the line to change the icon for mtInformation: procedure TForm1.FormCreate(Sender: TObject); begin MsgDlgIcons[TMsgDlgType.mtInformation]:=TMsgDlgIcon.mdiInformation; end; After the {$R *.dfm} line add: uses System.UITypes; Add a button to the form and create an onlick event: procedure TForm1.Button1Click(Sender: TObject); begin MessageDlg('test', TMsgDlgType.mtInformation, mbYesNo, 0) end; 1 Share this post Link to post
afturk 0 Posted July 25 (edited) 6 saat önce Lajos Juhász şunları söyledi: Yeni bir VCL bileşimi. Formcreate yöntemini oluşturmak için forma çift tıklayın ve mtInformation için simgeyi değiştirmek üzere şu bölümü ekleyin: prosedürü TForm1.FormCreate(Gönderen: TObject); başlangıç MsgDlgIcons[TMsgDlgType.mtInformation]:=TMsgDlgIcon.mdiInformation; oğul; {$R *.dfm} verisinden sonra şunu ekleyin: günlükler Sistem .UITypes ; Bir düğmeyi tamamlayın ve bir tıklamayla birleştirin: prosedürü TForm1.Button1Click(Gönderen: TObject); başlangıç MessageDlg('test', TMsgDlgType.mtInformation, mbYesNo, 0) bitiş; Thanks, I misunderstood the situation. It works fine Thank you very much Edited July 25 by afturk Share this post Link to post