ConfigDlgComponent

Declaration: ConfigDlgComponent(CompIx: integer; Params: string): integer;
This function allows you to configure individual components of the input dialog. The parameter CompIx specifies the component to be addressed. The properties to be changed have to be defined in the parameter Params, which is a string containing the definitions using a very simple syntax:

prop1=val1; prop2=val2; ....

The individual assignments have to be separated by semicolons, the values in an assignment have to be assigned by an equal sign (=). The properties vary from component to component and are ignored if a property is not valid for the particular component. The following properties are defined and can be adjusted by means of the ConfigDlgComponent function:

Property Valid for Explanation
allowedit gcColorSel controls whether the colors of the color dropdown box can be edited or not. If allowedit is set to TRUE any color can be edited by clicking the small triangle in the color field of the box. This opens a color dialog where you can select a suitable color.
high gcNumIO the upper boundary of the allowed range of input values in the gcNumIO component
hgt gcRadioBox the height of the gcRadioBox component. Please note that height indirectly controls the spacing between the displayed options.
inc gcNumIO the increment of the button in the gcNumIO component
left gcNumIO, gcEdit, gcCheckBox, gcLabel, gcRadioBox, gcDropDown, gcColorSel the position of the component in x direction (in pixels). By default, the left property is set to the AlignAt parameter of the CreateDialog function
low gcNumIO the lower boundary of the allowed range of input values in the gcNumIO component
opt gcRadioBox, gcDropDown the available options to select from. The options have to be separated by pipe (|) symbols. If you want a pipe symbol to appear in the option text, it has to be preceded by the escape character '\' (backslash). By default, the options are set to "Option 1|Option 2"
pal gcColorSel the default color palette to be loaded. The parameter pal may take values between 0 and 3:
0 ... basic VGA palette (the 16 colors of the VGA graphics adapter)
1 ... extended palette (the VGA palette plus 4 additional colors)
2 ... Windows system palette (the system colors of Windows)
3 ... standard palette (a combination of palette 1 and 2)
prec gcNumIO the precision of the display of the numeric value in the gcNumIO component. A positive value switches to fixed point notation using prec decimal places, a zero value switches to integer values, and a negative value switches to exponential notation with prec significant digits. Please note that prec does not affect the precision of the stored value, it only affects the displayed value. Values are stored internally always with double precision.
top gcNumIO, gcEdit, gcCheckBox, gcLabel, gcRadioBox, gcDropDown, gcColorSel the position of the component in y direction (in pixels). By default, the top property is set to the TopPos parameter of the CreateDialog function
val gcNumIO, gcEdit, gcCheckBox, gcLabel, gcRadioBox, gcDropDown the value to be assigned to the property; the type of the value depends on the component: gcNumIO expects a numeric value, gcEdit a text value (no apostrophes, just the text(1)), gcCheckbox expects a boolean value (TRUE or FALSE), and gcRadioBox and gcDropDown expect an integer value which controls the preselection of the options (a zero value deselects all options).
wid gcNumIO, gcEdit, gcRadioBox, gcDropDown, gcColorSel the width of the component (in pixels)

The function returns the following error codes:

 0 ... everything is OK
-1 ... the dialog does not exist (CreateDialog was not called)
-2 ... the component does not exist
-3 ... invalid parameter

Sample
program:
The following script fixes the deficiencies mentioned in the section ShowDialog by adjusting the initial values, the precision and the range of the numeric input elements:

program AskBodyData;

var
  DlgResults     : TVariantArray;

begin
CreateDialog (150,10,'Sample Dialog',
              [gcLabel, gcEdit, gcCheckbox, gcNumio, gcNumio, gcRadioBox],
              ['', 'Name', 'Left handed', 'Body height [cm]', 'Shoe Size',
               'Eye color|Please select closest color']);
ConfigDlgComponent(1,'left=10;val=Please enter your body data:');
ConfigDlgComponent(4,'prec=1;val=170;low=40;high=230');
ConfigDlgComponent(5,'prec=1;inc=0.5;val=40;low=16;high=60');
ConfigDlgComponent(6,'hgt=125;opt=brown|blue|gray|green|other;val=2');
DlgResults := ShowDialog;
if DlgResults[0] = 0 then
  begin
  cout ('Name: ',DlgResults[2]);
  cout ('Left handed: ',boolToStr(DlgResults[3],0));
  cout ('Body height: ',DlgResults[4]);
  cout ('Shoe size: ',DlgResults[5]);
  cout ('Eye color: ',IntToStr(DlgResults[6]));
  end;
end.



(1) If the text contains a semicolon (which is normally used as a command separator) you have to insert the escape character "\" (backslash) before the semicolon. Otherwise the text will be cut at the semicolon. Backslashes before a semicolon must be doubled.