Solved

MessageDlg defualt button

Posted on 2004-08-19
4
1,827 Views
Last Modified: 2008-02-01
How can I use from other syntaxes of MessageDlg function.
It's first syntax has 4 parameters that works proparely, but other syntaxes (overload) that have more than 4 parapeters don't work!!!
For example in the 6-parapeter that 5th parameter is for defining default button and 6th parameter is for Tbitmap don't work.!!!

this is the example of delphi help, but it doesn't work too!!!

procedure TForm1.Button1Click(Sender: TObject);
---------------
begin
  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;

end;
-----------------

Please guide me! Thanks
0
Comment
Question by:Ehsun
4 Comments
 
LVL 3

Expert Comment

by:Tyrsis
ID: 11849833
The MessageDlg's listed in the help file are actually for the CLX.  You'll have to use CLX if you want to use those versions of MessageDlg().  Or you can try copying the code out of QDialogs if you want to use it with VCL.  The VCL version of MessageDlg only has one version. (The first one listed I believe)

Tyrsis
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 11850363
you could use the windows.messagebox-API like

  if windows.messagebox(self.handle,  //handle
                       'MyMessageText',  //text
                       'MyMessageCaption' //Caption
                       ,MB_ICONINFORMATION or  //Icon to Show
                        mb_YesNoCancel or  //ButtonSet
                        MB_DEFBUTTON2) //Default Button (No in this Case)
                        = mrYes then;

meikl ;-)
0
 
LVL 3

Expert Comment

by:lmikle
ID: 11852280
Add a QDialogs to uses cause to get access to MessageDlg qith 6 parameters.
0
 
LVL 2

Expert Comment

by:Delani
ID: 11855270
What you really need is the standard VCL function Application.MessageBox, which wraps around the windows API. (You can look it up in the Delphi helpfile).

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question