DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....


SelectObjects

Declaration: SelectObjects (DataTable: TDataTable; AllowMultiSelect: boolean; PreSelObjs: TIntArray; Caption: string; var SelObjs: TIntArray): integer;
The function SelectObjects opens the object selection dialog and returns the selected objects when the user clicks the OK button. The parameter DataTable specifies the data table for which a object is to be selected. In order to use the main DataLab data container, use the global variable DStore. The parameter AllowMultiSelect controls whether several objects can be selected (TRUE) or only a single one (FALSE). You can pre-select objects by filling the dynamic array PreSelObjs by the corresponing object indices. The parameter Caption is a text which is shown as the caption of the dialog. The indices of the selected objects are returned in the parameter SelObjs. If AllowMultiSelect is FALSE SelObjs contains only a single index.

The function returns the following error codes:

 0 ... no error, SelObjs contains the selected objects
-1 ... the user cancelled the dialog
-2 ... PreSelObjs contains invalid object indices

Example: The following code snippet shows how to use the object selection dialog. It opens the dialog, showing the objects of the main data container, with the objects 2, 14 and 15 being pre-selected:

var
  i              : integer;
  nobj           : integer;
  oix            : integer;
  SelObjs        : TIntArray;

begin
if SelectObjects (DStore, true, [2,14,15], 'Select objects', SelObjs) = 0 then
  begin
  nobj := length(SelObjs);
  for i:=1 to nobj do
    begin
    oix := SelObjs[i-1];
        // do something with the object oix
    end;
  end;
end;