[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Dialogs' (#lcl)

# InputBox

Displays a box with specified title and prompt, and accepts user input in a text box.

## Declaration

Source position: dialogs.pp line 943

`function InputBox(`
`const ACaption: string;`
`const APrompt: string;`
`const ADefault: string`
`):string;`

## Arguments

`ACaption` |  | The caption for the dialog box.
`APrompt` |  | The text asking the user for his input.
`ADefault` |  | Default value for dialog box.

## Function result

The result of this function is the string the user entered in the editbox or the default string.

## Description

A default string can optionally be displayed in the text box. The user-entered or default string is returned as the function result.

If the user selects the OK button, the text in the text box is returned. If the user selects the Cancel button, the default string is returned.

## See also

ShowMessage |  | Displays the specified message text.

## 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;