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

InputComboEx

Displays an extended input combo-box dialog that allows entry of custom text values in its Items.

Declaration

Source position: dialogs.pp line 780

function InputComboEx(

  const ACaption: string;

  const APrompt: string;

  const AList: TStrings;

  AllowCustomText: Boolean = False

):string;

function InputComboEx(

  const ACaption: string;

  const APrompt: string;

  const AList: array of string;

  AllowCustomText: Boolean = False

):string;

Arguments

ACaption

  

Caption for the dialog.

APrompt

  

Prompt or label for the combo-box control.

AList

  

List of values displayed in the combo-box control.

AllowCustomText

  

True to allow new values to be added to the combo-box control.

Function result

String with the item selected in the combo-box, or an empty string if the dialog is cancelled.

Arguments

ACaption

  

Caption for the dialog.

APrompt

  

Prompt or label for the combo-box control.

AList

  

List of values displayed in the combo-box control.

AllowCustomText

  

True to allow new values to be added to the combo-box control.

Description

InputComboEx is an overloaded String function used to create and display a dialog form that can select a value specified in the AList argument. The overloaded variants allow the AList argument to be specified as a TStrings instance or an array of String values.

ACaption contains the caption displayed as the title for the dialog form.

APrompt contains a string displayed as the label for the combo-box control.

AllowCustomText is a Boolean argument which indicates if text values can be added to the combo-box control at run-time. When set to True, text can be added to the TComboBox control. This is enabled by setting its Style property to csDropDown instead of csDropDownList (the default). The default value for the argument is False and prevents adding custom text to the combo-box control.

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.

InputComboEx 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 value for the selected item in the combo-box control. The return value is an empty string ('') when the Cancel button or the Close border decoration is clicked.

See also

InputCombo

  

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

InputQuery

  

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


Version 3.2 Generated 2024-02-25 Home