[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

how do i put a message box in a component?

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
superboy
Asked:
superboy
  • 3
1 Solution
 
StevenBCommented:
 Use the MessageDlg or ShowMessage functions.

  Steven.
0
 
tomerleiCommented:
how to use messagegdlg?
0
 
StevenBCommented:
 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
 
StevenBCommented:
"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

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!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now