Constants to define the types of message dialogs.
Constants to define possible buttons on a dialog.
A "set" constant to show a Yes, a No and a Cancel button on a messagedialog.
A "set" constant to show a Yes, a No and a Cancel button on a messagedialog.
A "set" constant to show a Yes and a No button on a messagedialog.
A "set" constant to show a Yes and a No button on a messagedialog.
A "set" constant to show an OK and a Cancel button on a messagedialog.
A "set" constant to show an OK and a Cancel button on a messagedialog.
A "set" constant to show an Abort, a Retry and an Ignore button on a messagedialog.
A "set" constant to show an Abort, a Retry and an Ignore button on a messagedialog.
A constant array used to convert the kind of message buttons to the kind of BitButton.
This array gives you for each possible button type in a messagebox the corresponding kind of BitButton. For instance MsgDlgBtnToBitBtnKind[mbYes] has the value of bkYes. It is the reverse of BitBtnKindToMsgDlgBtn.
A constant array used to convert the kind of BitButton to the kind of message buttons.
This array gives you for each BitButton the corresponding type of button on a message dialog. For instance BitBtnKindToMsgDlgBtn[bkOK] has the value of mbOK. It is the reverse if MsgDlgBtnToBitBtnKind.
Common Dialog
Common Dialog: the base type fromwhich all other dialogs are derived. Use the "Create" method to make an instance of the dialog, the "Execute" method to show it to the user and the "Free" method to release it and free the used resources.
A public method of a dialog showing the appropriate dialog.
Use the execute method of a dialog to show it and then check the result to see if the user made a valid choice and pressed the OK button. The result of this method is a boolean. If it is true the user pressed OK.
Boolean
File Dialog
File Dialog: allows selection of a file from the current directory.
Internal procedure called to execute the dialog.
Public method to create a FileDialog.
Public method which causes the dialog to be shown.
Stringlist which stored the selected files.
Specifies the caption of the dialog.
Property to set the default file extension for the file dialog box.
String property to store the name of the file chosen by the user.
A string property which contains possible filters.
This is a string which contains the filters a user can choose from. The available filters and their description are separated by pipe symbols. To set this property during runtime assign a value like: "All files|*.*|Lazarus Project files|*.lpr"
Integer property setting the used file filter.
This property sets which file filter is teh default. Set this porperty to 2 to set the second filter as default.
Set the directory the dialog shows on opening.
A set of possible options which can be used in OpenDialog
Open Dialog
Open Dialog: open a file in the current directory, selected by File Dialog. If the required file is not in the current directory, another directory can be selected with Select Directory
A protected function which checkes if the choosen file meets all requirements.
A protected method which call CheckFile for each selected file.
Internal procedure called to execute the dialog.
Public method to create a OpenDialog
Event triggered when the user changes the folder in the OpenDialog.
This event is called when the user changes the folder (directory) in the OpenDialog. Note: changing the folder will also trigger the OnSelectionChange event.
Event triggered when the user changes the selection made in the OpenDialog.
This event is triggered when the user changes the selected file in the OpenDialog. Note: When the user changes the folder OnSelectionChange will be called first.
Save Dialog
Save Dialog: invoked when the application requires to save a file. If the file is already open or a filename has been specified, then the current buffer is written to that file; if no file is specified, the Save File As dialog is invoked and the buffer is saved to that file.
Select Directory Dialog
Select Directory Dialog: allows the user to select a directory when the diredtory structure is displayed as a tree.
Colour Dialog
Colour Dialog: presents a palette of colours to allow the user to select the required colour for text or graphics.

Call the Execute function to show the color dialog.
Internal property to store the value of the chosen color.
The method whoch create an instance of the TColorDialog.
The caption for the color dialog.
You can set the caption of the color dialog by changing this property.
A published property which reads en sets the FColor property
When the Color dialog has been shown and the user pressed OK, the FColor property contains the chosen color.
Colour Button
Colour Button: Pressing this button causes the Colour Dialog to be presented, allowing a choice of colour for text or graphics.
A set of constants to set the options of a Font dialog.
Font Dialog
Font Dialog: opens a dialog allowing choice of a font for textual displays
A private method which sets the font of the dialog.
Public method to create a FontDialog.
Specifies the caption of the dialog.
Property to store the chosen font.
A set of options available from TFontDialogOptions
The text displayed in the preview pane of the dialog.
Standard the preview plane of the dialog shows all letters both in uppercase and lowercase.
A set of possible options which can be used in Find-dialogs.
A set of possible options which can be used in Find-dialogs.
If set the "Down" radiobutton is selected.
This option will be set when the user presses "Find Next"
If set the "Match case" checkbox is hidden from the Find dialog
If set the "Whole word" checkbox is hidden from the Find dialog
If set the "Up" and "Down" radiobuttons are hidden from the Find dialog
This flag is set when the user checks the "Match case" checkbox.
If set the "Match case" checkbox is disabled in the Find dialog
If set the "Up" and "Down" radiobuttons are disabled in the Find dialog
If set the "Whole word" checkbox is disabled in the Find dialog
This flag is set if only the first occurence of the search string is to be replaced with the replace string.
This flag is set if all occurences of the search string are to be replaced with the replace string.
This flag is set when the user checks the "Whole word" checkbox.
If set the dialog will display a help button.
A set of TFindOption
Message Dialog
Message Dialog: show a message to the user and receive his response.

There are two versions of this function. The first version displays a dialog with the standard caption, the second version enables you to set the caption.

function MessageDlg(const aMsg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer; function MessageDlg(const aCaption, aMsg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;

Two versions of this function, ie first 'Caption' argument is optional; if omitted, caption is missing from box

This is the most complete and elaborate of the message dialogs, and allows the programmer considerable control over the appearance of the dialog box.
The arguments defining the kind of box and its icon are types rather than integer constants, and the buttons can be specified as a set in square brackets eg [mbRetry, mbIgnore, mbAbort, mbCancel].
The HelpCtx argument is not currently implemented and should be set to zero. The return value from the Function is the identity of the button pressed, expressed as an integer (see the definitions below, [mrNone..mrAll]).
The result of this function is the button the user pressed to close the dialog.
The result of this function is the button the user pressed to close the dialog.
Used to set the caption of the messagedialog.
Sets the caption of the messagedialog shown by this function.
The message to be shown.
The message shown to the user.
The type of dialog to be shown
The DlgType parameter indicates the type of dialog to show. You can choose from mtWarning, mtError, mtInformation, mtConfirmation or mtCustom.
Determines the buttons shown on the messagedialog
Buttons indicate which set of button captions have to be shown on the dialog. You can choose from predefined sets: mbAbortRetryIgnore, mbOKCancel, mbYesNo, mbYesNoCancel, or you can make your own set.
HelpCtx is used to specify which topic form the help should be shown.
HelpCtx is used to specify which topic form the help should be shown.
An extended MessageDlg function.
This function performs the same function as the MessageDlg function. It has been extended with parameters to place the dialog on a certain postion on the screen in stead of in the centre of the screen. The MessageDlgPos function does not enable you to choose the caption of the dialog.
The result of this function is the button the user pressed to close the dialog.
The result of this function is the button the user pressed to close the dialog.
The message to be shown.
The message shown to the user.
The type of dialog to be shown
The DlgType parameter indicates the type of dialog to show. You can choose from mtWarning, mtError, mtInformation, mtConfirmation or mtCustom.
Determines the buttons shown on the messagedialog
Buttons indicate which buttons have to be shown on the dialog. You can choose from predefined sets: mbAbortRetryIgnore, mbOKCancel, mbYesNo, mbYesNoCancel, or you can make your own set.
HelpCtx is used to specify which topic form the help should be shown.
HelpCtx is used to specify which topic form the help should be shown.
X specifies the position of the left side of the dialog
X specifies the position of the left side of the dialog.
Y specifies the position of the top side of the dialog
Y specifies the position of the top side of the dialog
An extended MessageDlgPos function.
This function enables you to specify a Helpfile which has to be shown when the user presses F1.
The result of this function is the button the user pressed to close the dialog.
The result of this function is the button the user pressed to close the dialog.
The message to be shown.
The message shown to the user.
The type of dialog to be shown
The DlgType parameter indicates the type of dialog to show. You can choose from mtWarning, mtError, mtInformation, mtConfirmation or mtCustom.
Determines the buttons shown on the messagedialog
Buttons indicate which buttons have to be shown on the dialog. You can choose from predefined sets: mbAbortRetryIgnore, mbOKCancel, mbYesNo, mbYesNoCancel, or you can make your own set.
HelpCtx is used to specify which topic form the help should be shown.
HelpCtx is used to specify which topic form the help should be shown.
X specifies the position of the left side of the dialog
X specifies the position of the left side of the dialog
Y specifies the position of the top side of the dialog
Y specifies the position of the top side of the dialog
The Helpfile that has to be shown when the user presses F1
The name of the helpfile to be shown when the user presses F1 in the dialog.
Show a question to the user and get a response
QuestionDlg has the same functionality as MessageDlg except for the parameter Buttons which is of a different type. You can define your own captions and return values of this function.
The result of this function is the button the user pressed to close the dialog.
The result of this function is the button the user pressed to close the dialog.
Used to set the caption of the question dialog.
Set the caption of the question dialog shown by this function.
The question to be shown.
The question the user has to answer.
The type of dialog to be shown in fact which icon will be shown.
An array of return values and caption for the buttons on the question dialog.
Buttons is defined as a array of const. This means you can define any number of buttons to be shown. If your array consists of only predefined return values like mrOK and mrCancel, the standard OK and Cancel buttons will be shown.
The strength of this functions is however that you can fill the array like: [400, 'Yes!!!', 401, 'Are you mad?', 402, 'My mistake'], which will create a dialog with three buttons; the captions of the buttons will be the strings given in the array.
The return value of the function will be 400, 401 or 402, depending on whether the user clicked the 'Yes!!!', the 'Are you mad?' or the 'My mistake' button.
HelpCtx is used to specify which topic form the help should be shown.
HelpCtx is used to specify which topic form the help should be shown.
Show Message
Procedure ShowMessage (const Msg: string);

{ Defined in Dialogs.pp }

The simplest message dialog: takes a simple string as argument, displays it in a stereotyped box, and waits for a mouse-click or enter-key event before returning to the calling routine or program.
This is a modal procedure call, that is the box is displayed, receives focus, and does not relinquish focus until the OK box is clicked or otherwise selected.

Example

Program LazMessage; Uses Dialogs; begin ShowMessage ('This is a message from Lazarus') end.
A string constant containing the message to be shown.
A string constant containing the message to be shown.
Shows a message assembled from a format string and an array of arguments.
This procedure is an extension to the ShowMessage procedure. The parameters it takes are the same as the Format function.
The format string
The parameters to be inserted in the message.
Shows a message box at a given screen position.
Shows a message box at a given screen position.
A string constant which is the message to ne shown.
The horizontal position of the messagebox.
The vertical position of the messagebox.
Input Query
Function InputQuery(const ACaption, APrompt : String; MaskInput : Boolean; var Value : String) : Boolean; Function InputQuery(const ACaption, APrompt : String; var Value : String) : Boolean;

Two versions of this function which displays a prompt and expects user input of textual data;
the first includes a MaskInput boolean argument which determines whether the user input is masked out by asterisks in the text-input box (like during entry of a password),
the second omits this property.
The text entered by the user is returned in the variable argument 'Value';
the function result is a boolean which returns TRUE if the OK button was pressed, or FALSE if the box was closed by any other mechanism (such as clicking the 'Close' icon on the top title bar).
Omitting the MaskInput argument is equivalent to setting it FALSE.
This function returns a Boolean as result
If the result is True, the user pressed OK in the dialog box. Did the user press Cancel the result will be false.
The caption for the dialogbox
The text asking the user for his input.
Determines if the dialog shows *s or the actual input.
Set MaskInput to true if you want to hide the input and display asterixes.
The value the user entered.
When the DialogBox is shown the text in the Editbox will be Value. When ENTER is pressed or OK clicked, Value will be the text from the Editbox.
Use InputQuery to show a dialog box to get some input from the user
InputQuery works a lot like InputBox, however the result of InputQuery is a Boolean indicating whether the user pressed OK. If the result is false the user pressed Cancel. If you want a default value to be returned when the user presses Cancel, use InputBox There are two versions of this function, the difference between them is the ability to mask the users input.
This function returns a Boolean as result
If the result is True, the user pressed OK in the dialog box. Did the user press Cancel the result will be false.
The caption for the dialogbox
The text asking the user for his input.
The value the user entered.
When the DialogBox is shown the text in the Editbox will be Value. When ENTER is pressed or OK clicked, Value will be the text from the Editbox.
InputBox
Function InputBox(const ACaption, APrompt, ADefault : String) : String;

Displays a box with defined title and prompt, and expects user input in a text box. A default string can optionally be displayed in the text box. The user-entered or default string is returned as the function result.

Example

Uses forms, lcltype, dialogs, controls; procedure TryInputBox; var userstring: string; begin userstring := InputBox ('Get some text input', 'Please type in some information', 'Some sample text'); ShowMessage (userstring) end;
The result of this function is the string the user entered in the editbox.
The result of this function is the string the user entered in the editbox.
The caption for the dialogbox
The text asking the user for his input.
Default value for dialog box
The value of the editbox in the dialog will have this value.
Password Box
PasswordBox: a specialised form of the InputQuery. The editbox on the dialog box will mask the input. The only parameters are aCaption and aPrompt.

Function PasswordBox(const ACaption, APrompt : String) : String;

Behaves very similarly to the InputQuery function with MaskInput = TRUE; the difference is that the password that was typed in is returned as the result of the function (like InputBox).
The string the user entered.
The caption for the dialog
A prompt to ask for the users input.
A function that allows to user to select a directory.
This function wil show a dialog which allows the user to select the required directory when the directory structure is displayed as a tree.
Under Windows the caption from the resulting dialog cannot be set, but the label above the directory tree will have this value.
There are two version of this function, the second one having the ability to indicate whether hidden folders should be shown as well.
A boolean indicating if the user pressed OK.
A boolean indicating if the user selected a directory and pressed OK.
A constant which sets the caption of the shown dialog.
A constant which sets the caption of the shown dialog.
The directory the dialog should start in.
The directory the dialog should start in.
If a valid directory is given, the selected directory in the tree will be set to this directory.
A variable which on exit contains the selected directory.
A variable which on exit contains the selected directory.
A boolean constant indicating whether hidden folders should be shown too.
A boolean constant indicating whether hidden folders should be shown too.