DoDialogGetListItems

Prototype

Matrix DoDialogGetListItems( Matrix mSelections, String sTitle, String sMessage, Matrix mItems, Matrix mColumnHeaders )

Return Value

The return value is 1 on success or 0 on failure. If the user clicks Cancel or closes the dialog box, the return value is 0.

Parameters

Matrix mSelections
Upon successful return, mSelections is a column vector containing the 1-based indices of the rows in mItems that were selected by the user.

String sTitle
The title of the dialog box.

String sMessage
A message that appears at the top of the dialog box.

Matrix mItems
A character matrix containing the items to be displayed in the dialog box. Each row in mItems is treated as a single selectable item. If mItems contains multiple columns, each item is formatted into multiple columns in the dialog box. In this case, the mColumnHeaders parameter must specify the text for each column header.

Matrix mColumnHeaders
A character vector specifying the text for each column header. The string mColumnHeaders[i] specifies the heading text for column mItems[,i]. If mItems contains only one column, you are not required to have a column header. In this case, pass the numeric scalar value zero for the mColumnHeaders parameter.

Remarks

This module displays a dialog box that enables the user to select items from a list.

The dialog box's OK button is enabled when the user has made at least one selection.

The dialog box enables you to sort the items by a particular column by clicking the column's header. The first time you click a column's header, the items are sorted in ascending order by that column. The second time you click a column's header, the items are sorted in descending order by that column. Sorting the items does not affect the indices returned in the mSelections matrix. The indices in mSelections are always relative to the original ordering.

Example
declare DataObject dobj;
dobj = DataObject.CreateFromFile( "baseball" );

numvar = dobj.GetNumVar();
do i = 1 to numvar;
    varnames = varnames // dobj.GetVarName( i );
    varlabels = varlabels // dobj.GetVarLabel( varnames[i] );
    if dobj.IsNumeric( varnames[i] ) then
        vartypes = vartypes // "Numeric";
    else
        vartypes = vartypes // "Character";
end;

ok = DoDialogGetListItems(
        selections,
        "Select Variables",
        "Please select one or more variables.",
        varnames || varlabels || vartypes,
        { "Name", "Label", "Type" } );
if ok then
    print (varnames[selections]);
else
    print "Function failed";
See Also

DoDialogGetListItem
DoDialogGetListItemsEx