Skip to main content

TdxInputQueryValidationProc Type

The procedural type for validation routines used in input query dialogs.

Declaration

TdxInputQueryValidationProc = reference to procedure(ValueIndex: Integer; const Value: string; var IsValid: Boolean);

Parameters

Name Type Description
ValueIndex Integer

The index of the currently evaluated string.

Value string

The currently evaluated string.

IsValid Boolean

If False, the input dialog box disables the OK button and ignores the Enter keystroke. If True, the content of all displayed text editors is considered valid.

Remarks

The following code example demonstrates a validation routine that disables the OK button and ignores the Enter keystroke if at least one of the displayed text editors is empty:

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

procedure TMyForm.ValidationProcedure(ValueIndex: Integer; const Value: string; var IsValid: Boolean);
begin
  if Value = '' then  // Disables the "OK" button if at least one editor value is an empty string
    IsValid := False;
end;

procedure TMyForm.cxButton1Click(Sender: TObject);
var
  APrompts, AValues: array of string;
begin
  SetLength(APrompts, 2);
  SetLength(AValues, 2);
  APrompts[0] := 'First Name:';
  APrompts[1] := 'Last Name';
  dxInputQuery('New User', APrompts, AValues, ValidationProcedure);
end;

VCL Editor Library: A Simple Modal Dialog Box with User Input Validation

Direct TdxInputQueryValidationProc Procedural Type References

The following global methods accept a routine of the TdxInputQueryValidationProc type as the AValidationProc parameter:

dxInputQuery(string,string,string,TdxInputQueryValidationProc)
Invokes a modal input dialog box that prompts a user to enter a string and checks if the user input is valid.
dxInputQuery(string,string[],string[],TdxInputQueryValidationProc)
Invokes an input dialog box that allows users to enter a string.
dxSelectQuery(string,string,TStrings,string,Boolean,TdxInputQueryValidationProc)
Invokes a modal input dialog box that allows users to select a value in a combo box.
See Also