CreateDialog

Declaration: CreateDialog(AlignAt, TopPos: integer; DialogCaption: string; Components: TGcArray; Captions: TStrArray): integer;
Creates a dialog window which can contain up to 20 different input components. The input components are arranged in vertical order at the position defined by the parameter AlignAt. The first input element is located at the position TopPos (both positions are pixel coordinates, with the top left corner of the working area as the reference point having the coordinates [0,0]).

The caption of dialog window is controlled by the parameter DialogCaption. The type of the components have to be specified in the open array Components, their captions (which are displayed left to the components) are specified in the open string array Captions.(1) Both arrays have to have the same size.

The dialog supports the following types of components:

gcEdit: an edit component to enter text
gcNumio: a numerical component which can be configured in many aspects (see the section on the function ConfigDlgComponent for details).
gcCheckbox: a checkbox component for selecting binary options
gcColorSel: a color selection drop down box
gcLabel: a label component for displaying information
gcRadioBox: a group of radio buttons for selecting one out of several options
gcDropDown: a drop down list box for selecting one of several options

The default positions of the components as well as other specific component parameters can be adjusted by using the function ConfigDlgComponent.

The function returns the following error codes:

 0 ... everything is OK
-1 ... too many components
-2 ... the number of components and the number of captions do not match

ATTENTION: Please note that the dialog will become active and visible only after calling the function ShowDialog.

Example: The statement
    CreateDialog (150,10,'Sample Dialog',
                  [gcEdit, gcCheckbox, gcNumio],
                  ['Name', 'Left handed', 'Threshold']);
will create the following dialog:



(1) Please note that a gcRadioBox component has in fact two captions: the standard caption left to the component and a headline caption at the top of the group box. These two captions can be set separately by inserting a pipe character (|) in the caption string; the part left of the separator is displayed as the standard caption, the part after the separator is displayed as headline.