Solved

how do i put a message box in a component?

Posted on 1998-02-03
4
161 Views
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?
0
Comment
Question by:superboy
  • 3
4 Comments
 
LVL 4

Accepted Solution

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

  Steven.
0
 
LVL 4

Expert Comment

by:tomerlei
ID: 1358226
how to use messagegdlg?
0
 
LVL 4

Expert Comment

by:StevenB
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.

Unit
Dialogs

Category
dialog and message routines

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

Description
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);

Description
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.

type

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

  TMsgDlgButtons = set of TMsgDlgBtn;

Description
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



0
 
LVL 4

Expert Comment

by:StevenB
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.




0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now