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

# InputCombo

Creates and executes a combo-box dialog with the specified Caption, Prompt, and list of selectable values.

## Declaration

Source position: dialogs.pp line 1046

`function InputCombo(`
`const ACaption: string;`
`const APrompt: string;`
`const AList: TStrings`
`):Integer; function InputCombo(`
`const ACaption: string;`
`const APrompt: string;`
`const AList: array of string`
`):Integer;`

## Arguments

`ACaption` |  | Caption or title for the dialog.
`APrompt` |  | Label displayed for the combo-box control on the dialog.
`AList` |  | List of values which can be displayed and selected using the combo-box.

## Function result

Ordinal position for the value selected in AList, or -1 if an option was not selected.

## Arguments

`ACaption` |  | Caption or title for the dialog.
`APrompt` |  | Label displayed for the combo-box control on the dialog.
`AList` |  | List of values which can be displayed and selected using the combo-box.

## Description

InputCombo is an Integer function used to create and display an input dialog with the values specified in the arguments to the routine.

The dialog form is constructed at run-time, and includes the controls needed to display the prompt (TLabel) and list of selectable items (TComboBox). It also includes a button panel (TButtonPanel) with Ok and Cancel buttons. The Caption for the dialog form is set to the ACaption argument.

The dimensions for the dialog form are determined by the maximum length of the string values passed in the function parameters. The form uses auto-scaling when enabled for the Application. Scaled size values are applied to the font for the form and its controls, as well the margins and separators used for control alignment. Anchors and BorderSpacing are used for control alignment to preserve their layout during auto-sizing and scaling operations. The display Position for the form is set to poScreenCenter.

InputCombo calls the ShowModal method for the TForm instance to display the dialog and capture the modal result value. When the modal result is mrOk (the OK button was pressed), the return value contains the ordinal position for the item in AList that was selected in the combo-box control. The return value is -1 when the Cancel button or the Close border decoration is clicked.

Use InputComboEx to display a dialog form that allows custom text to be entered in its combo-box control. Use InputQuery to display a dialog form which allows entry of a text value using an edit mask.

## See also

InputComboEx |  | Displays an extended input combo-box dialog that allows entry of custom text values in its Items.
InputQuery |  | Use InputQuery to show a dialog box to get input from the user.