Sign in Join
FPDoc Onlineexperiment

TWidgetSet.MessageBox function

Member of TWidgetSetpublicIn unit InterfaceBase

Displays a modal dialog message box.

Declaration

pascal
function MessageBox(hWnd: HWND; lpText: PChar; lpCaption: PChar; 
 uType: Cardinal=MB_OK): Integer; virtual

Description

The MessageBox function displays a modal dialog with the given text, caption, icon and buttons.

uType is a combination of flags from the following lists.

The shown buttons are selected by one of:

MB_ABORTRETRYIGNORE
Abort, Retry, and Ignore.
MB_CANCELTRYCONTINUE
Cancel, Try Again, Continue. Use this message box type instead of MB_ABORTRETRYIGNORE.
MB_OK
OK.
MB_OKCANCEL
OK and Cancel.
MB_RETRYCANCEL
Retry and Cancel.
MB_YESNO
Yes and No.
MB_YESNOCANCEL
Yes, No, and Cancel.

Add MB_HELP for an Help button. When the user clicks the Help button or presses F1, the owner window receives a WM_HELP message.

An icon can be added by one of:

MB_ICONEXCLAMATION, MB_ICONWARNING
Exclamation point icon
MB_ICONINFORMATION, MB_ICONASTERISK
The letter "i" in a circle
MB_ICONQUESTION
Question mark icon
MB_ICONSTOP, MB_ICONERROR, MB_ICONHAND
Stop sign icon

The default button number, activated when the user presses Enter, can be indicated by one of:

  • MB_DEFBUTTON1
  • MB_DEFBUTTON2
  • MB_DEFBUTTON3
  • MB_DEFBUTTON4

Other Windows MessageBox-specific options are not (yet) implemented on other platforms.

The function result corresponds to the button pressed:

  • IDABORT
  • IDCANCEL
  • IDCONTINUE
  • IDIGNOE
  • IDNO
  • IDOK
  • IDRETRY
  • IDTRYAGAIN
  • IDYES

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.