Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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

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

#Declaration

Delphi
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 displayed 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 display 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 displayed dialog box disables the OK button and ignores the Enter keystroke until a user enters or selects a valid value.

#Code Example: Display an Input Dialog with a Combo Box

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