DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information.... |
Home Programming DataLab DLabPascal I/O Functions Dialogs ShowDialog | |||||||||||||||||||||||||||||||||
See also: CreateDialog, ShowStatus, MessageDlg, TextDialog, NumDialog, ConfigDlgComponent
|
|||||||||||||||||||||||||||||||||
ShowDialog
The available input components return the following results:
The function returns the following error codes: 0 ... everything is OK
|
Sample program: |
The following script displays a dialog with four elements which allow for the input of a name and three body parameters:
program AskBodyData_V1; var DlgResults : TVariantArray; aux : TVariantArray; begin CreateDialog (150,10,'Sample Dialog', [gcLabel, gcEdit, gcCheckbox, gcNumio, gcNumio, gcRadioBox, gcColorSel], ['', 'Name', 'Left handed', 'Body height [cm]', 'Shoe Size', 'Eye color|Please select closest color', 'Your favorite color']); ConfigDlgComponent(1,'left=10;val=Please enter your body data:'); ConfigDlgComponent(4,'box=unchecked;rtxt=auto'); 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)); aux := DlgResults[4]; cout ('Body height: ', aux[0]); cout ('Body height freeze box checked: ', aux[1]); aux := DlgResults[5] cout ('Shoe size: ',aux[0]); cout ('Eye color: ',IntToStr(DlgResults[6])); cout ('Favorite Color: ', Hex(DlgResults[7],8)); 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, nobody specifies for example the shoe size with two decimal places). The function ConfigDlgComponent can be used to adjust the input components accordingly. |