ShowDialog

Declaration: ShowDialog: TVariantArray;
Displays the input dialog which has been created by CreateDialog and optionally adapted by ConfigDlgComponent. The dialog is always a modal window which can be closed either by clicking the OK button or by clicking the cancel button in the upper right corner of the dialog.

The entered parameters are returned as an open variant array. The number of returned variants N is equal to the number of defined components P plus 1. The variant array has a 0-based index. The array element with index 0 returns an error code, all other elements (1..N) return the input values of the components of the dialog.

 0 ... user clicked the OK button
-1 ... dialog does not exist
-2 ... dialog has been cancelled (by closing it without clicking the OK button

Sample
program:
The following script displays a dialog with four elements which allow for the input of a name and three body parameters:
program AskBodyDimensions;

var
  DlgResults     : TVariantArray;

begin
CreateDialog (150,10,'Sample Dialog',
              [gcEdit, gcCheckbox, gcNumio, gcNumio],
              ['Name', 'Left handed', 'Body height [cm]', 'Show size [cm]']);
DlgResults := ShowDialog;
if DlgResults[0] = 0 then
  begin
  couts ('Name: '+DlgResults[1]);
  couts ('Left handed: '+boolToStr(DlgResults[2],0));
  coutf ('Body height: ',DlgResults[3]);
  coutf ('Shoe size: ',DlgResults[4]);
  end;
end.

This dialog exhibits a few weaknesses: (1) the range of allowed parameters is given by the default values (0..1000) which is not meaningful, (2) no initial values are displayed and (3) the precision of the numeric input values is two decimal places by default (which is nonsense because the daily variations are much higher than 0.1 mm). The function ConfigDlgComponent can be used to adjust the input components accordingly.