Solved

MessageDlg defualt button

Posted on 2004-08-19
4
1,830 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
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…

751 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