Skip to main content

dxSelectQuery(string,string,TStrings,string,Boolean,TdxInputQueryValidationProc) Method

Invokes a modal input dialog box that allows users to select a value in a combo box.

Declaration

function dxSelectQuery(const ACaption: string; const APrompt: string; AValues: TStrings; var AValue: string; AAllowCustomValues: Boolean = False; AValidationProc: TdxInputQueryValidationProc = nil): Boolean;

Parameters

Name Type Description
ACaption string

The caption of the invoked input dialog box.

APrompt string

The label for the displayed combo box.

AValues TStrings

The list of strings that correspond to the list of available choices.

AValue string

The selected value.

AAllowCustomValues Boolean

True if users can enter a custom value; otherwise, False.

AValidationProc TdxInputQueryValidationProc

The procedure that validates a value entered by a user.

Returns

Type Description
Boolean

True if a user clicks the OK button or presses the Enter key. False if a user clicks the Cancel or Close button, or presses the Esc key.

Remarks

Call the dxSelectQuery function to invoke a simple input dialog box that prompts a user to choose one of the string values displayed in a combo box. The dialog imports all look & feel settings from the TdxSkinController component if it is in an application project. You can pass True as the optional AAllowCustomValues parameter to allow users to enter a custom string in addition to the options listed in the combo box. If you pass a validation routine as the optional AValidationProc parameter, the invoked dialog box disables the OK button and ignores the Enter keystroke until a user enters or selects a valid value.

Code Example

uses
  dxInputDialogs;  // This unit declares the dxSelectQuery function
// ...

procedure TMyForm.cxButton1Click(Sender: TObject);
var
  AUserInput: string;
  AValues: TStringList;
begin
  AValues := TStringList.Create;
  try
    AValues.Add('January');
    AValues.Add('February');
    AValues.Add('March');
    AValues.Add('April');
    AValues.Add('May');
    AValues.Add('June');
    AValues.Add('July');
    AValues.Add('August');
    AValues.Add('September');
    AValues.Add('October');
    AValues.Add('November');
    AValues.Add('December');
    dxSelectQuery('Choose Month', 'Month:', AValues, AUserInput);
  finally
    AValues.Free;
  end;
end;

VCL Editor Library: A Simple Modal Dialog Box that Allows Users to Select a Value in a Combo Box

See Also