InputComboEx function
Displays an extended input combo-box dialog that allows entry of custom text values in its Items.
Declaration
function InputComboEx(const ACaption: string; const APrompt: string;
const AList: TStrings;
AllowCustomText: Boolean=False): stringArguments
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.
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
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
