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

# InputQuery

Use InputQuery to show a dialog box to get some input from the user

## Declaration

Source position: line 0

`function InputQuery(`
`const ACaption: String;`
`const APrompt: String;`
`MaskInput: Boolean;`
`var Value: String`
`):Boolean; function InputQuery(`
`const ACaption: String;`
`const APrompt: String;`
`var Value: String`
`):Boolean;`

## Arguments

`ACaption` |  | The caption for the dialogbox
`APrompt` |  | The text asking the user for his input.
`MaskInput` |  | Determines if the dialog shows *s or the actual input.
`Value` |  | The value the user entered.

## Function result

Result is True if the user pressed OK or hit RETURN in the dialog box. If the user pressed Cancel or the dialog was closed without pressing a button the result will be false.

## Arguments

`ACaption` |  | The caption for the dialogbox
`APrompt` |  | The text asking the user for his input.
`Value` |  | The value the user entered.

## Function result

Result is True if the user pressed OK or hit RETURN in the dialog box. If the user pressed Cancel or the dialog was closed without pressing a button the result will be false.

## Description

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.

## See also

InputBox |  | Displays a box with defined title and prompt, and expects user input in a text box
PasswordBox |  | Password Box

## Example

     Uses forms, lcltype, dialogs, controls;

     procedure TryInputQuery;
     var QueryResult: boolean;
       userstring: string;
     begin
       if InputQuery ('Question', 'Type in some data', TRUE, userstring)
       then ShowMessage (userstring)
       else
       begin
         InputQuery ('Don''t be silly', 'Please try again', userstring);
         ShowMessage (userstring)
       end
     end;

The latest version of this document can be found at lazarus-ccr.sourceforge.net.