how do i put a message box in a component?

Posted on 1998-02-03
Last Modified: 2010-04-04
i am writing a component which pops up a message box
which asks the user whether he wants to close a form
when he presses on the component..the component is
derived from tbutton
how do i make the message box pop up?
Question by:superboy
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
  • 3

Accepted Solution

StevenB earned 0 total points
ID: 1358225
 Use the MessageDlg or ShowMessage functions.


Expert Comment

ID: 1358226
how to use messagegdlg?

Expert Comment

ID: 1358227
 I really don't think that I can explain it any better than the delphi help:

MessageDlg displays a message dialog box in the center of the screen.


dialog and message routines

function MessageDlg(const Msg: string; AType: TMsgDlgType; AButtons: TMsgDlgButtons; HelpCtx: Longint): Word;

Call MessageDlg to bring up a message box and obtain the user's response. The message box displays the value of the Msg parameter.  Use the AType parameter to indicate the purpose of the dialog.  Use the AButtons parameter to indicate what buttons should appear in the message box.  Use the HelpCtx parameter to specify the context ID for the help topic that should appear when the user clicks the help button or presses F1 while the dialog is displayed.
MessageDlg returns the value of the button the user selected. These are the possible return values:

Return values            
mrNone          mrAbort         mrYes
mrOK            mrRetry         mrNo
mrCancel        mrIgnore        mrAll

TMsgDlgType defines values describing the type of message box.

  type TMsgDlgType = (mtWarning, mtError, mtInformation, mtConfirmation, mtCustom);

The TMsgDlgType type defines the values describing the type of message box. The TMsgDlgType is used by the MessageDlg and MessageDlgPos functions. The following table lists the possible values:

mtWarning       A message box containing a yellow exclamation point symbol.
mtError         A message box containing a red stop sign.
mtInformation   A message box containing a blue "i".
mtConfirmation  A message box containing a green question mark.
mtCustom        A message box containing no bitmap. The caption of the message box is the name of the application's executable file.

TMsgDlgButtons defines a set of values used by MessageDlg and MessageDlgPos.


  TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, mbAll, mbHelp);

  TMsgDlgButtons = set of TMsgDlgBtn;

The TMsgDlgButtons type defines the set of values a button in a message box can have. The TMsgDlgButtons type is used by the MessageDlg and MessageDlgPos functions. The following tables lists the possible values:

Value      Meaning
mbYes            A button with a green check mark and the text 'Yes' on its face
mbNo            A button with a red circle and slash mark through the circle and the text 'No' on its face
mbOK            A button with a green check mark and the text 'OK' on its face
mbCancel      A button with a red X and the text 'Cancel' on its face
mbHelp        A button with a cyan question mark and the text 'Help' on its face
mbAbort       A button with a red check mark and the text 'Abort' on its face
mbRetry       A button with two green circular arrows and the text 'Retry' on its face
mbIgnore      A button with a green man walking away and the text 'Ignore' on its face
mbAll         A button with a green double check marks and the text 'All' on its face


Expert Comment

ID: 1358228
"Regarding superboy's question in the Experts Exchange(sm) Delphi Programming topic area titled "how do i put a message box in a component?"...

Congratulations!  You earned 0 quality points for answering superboy's question! These points will be added to your expert score in the Delphi Programming topic area."

Cheers Superboy. Its good to feel appreciated.


Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

687 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