Chapter Contents

Previous

Next
DEVLIST

DEVLIST



Displays a selection list of graphic hardware devices and returns user selections

Category: Selection List


Syntax
Details
Examples
Example 1: Displaying the Printer Devices of a Catalog
Example 2: Using the Results of a DEVLIST
See Also

Syntax

selections=DEVLIST(catalog-name,device<,message
<,autoclose<,num-sel>>>);

selections
are one or more user selections from the list, or blank if the selection list window is closed and no selections are made.

Type: Character

catalog-name
is the catalog that lists the devices. Usually the catalog SASHELP.DEVICES is used as catalog-name.

Type: Character

device
is the type of device to be listed:

'CAMERA'
lists device catalog entries for film recorders.

'DEFAULT'
returns the current device name, description, and type instead of displaying a list.

'EXPORT'
lists device catalog entries for device drivers that produce a graphics stream file.

'MONITOR'
lists device catalog entries for video displays.

'PLOTTER'
lists device catalog entries for plotters.

'PRINTER'
lists device catalog entries for printers.

Type: Character

message
is the text for a message to be displayed above the selection list. The default message tells users to make up to the number of selections specified in num-sel.

Type: Character

autoclose
specifies whether the selection list window closes automatically after a user makes a selection when only one choice is allowed:
'Y' closes the window automatically. (This is the default.)
'N' leaves the window open until the user explicitly closes it.

This option is ignored when num-sel is not 1. However, use '' as a placeholder if you are also specifying a value for num-sel.

Type: Character

num-sel
specifies the maximum number of items a user can select from the list. To display the list for information purposes only (no selections allowed), specify 0. To specify an unlimited number of selections, use a value that is larger than the number of available selections about graphic device drivers such as 9999.

Type: Numeric


Details

The value in selections consists of a 40-character description, an 8-character device name, and an 8-character device type. For additional details about graphic device drivers, see SAS/GRAPH Software: Reference and the SAS online Help for SAS/GRAPH software.

You can provide a default value or an initial selected value in the list by providing a value for the selections variable before calling DEVLIST. If selections contains valid entry names when the function is invoked, those names are automatically designated as selected when the selection list is displayed.

If a user closes the selection list window without making a selection, then DEVLIST returns a blank value unless there was an initial value for the selections variable before DEVLIST was called.

When multiple selections are allowed, selections contains the first value selected from the list. However, the values for all selections can be returned in the current result list, if one is available. The current result list is a special SCL list that is automatically filled with the values selected from a selection list. To use a current result list, use the MAKELIST function to create the list, and use the CURLIST function to designate it as the current result list. The current result list must exist before you call DEVLIST.

When DEVLIST is invoked, the current result list is cleared. After DEVLIST is invoked, the result list contains the following named items:

TAG
identifies the list as one that was created by the DEVLIST function.

Type: Character

COUNT
contains either the number of selected elements, or 0 if a user makes no selections or issues a CANCEL command in the list window.

Type: Numeric

DESC
contains the description of the selected device. There is one DESC element for each selection. The value of DESC is in the case that was entered originally.

Type: Character

DEVICE
contains the name for each selected device. There is one DEVICE element for each selection.

Type: Character

TYPE
contains the type of each selected device. There is one TYPE element for each selection.

Type: Character


Examples

Example 1: Displaying the Printer Devices of a Catalog

Display a list of devices of type PRINTER that are available in the catalog SASHELP.DEVICES. After the user selects one device from the list, the program uses the SUBSTRING function to extract the individual items of information returned by DEVLIST.

select=devlist('sashelp.devices','printer',
  'Select a device.');
descript=substr(select,1,40);
device=substr(select,41,8);
devtype=substr(select,49,8);

Example 2: Using the Results of a DEVLIST

Use the current result list to process multiple selections:

listid=makelist();
rc=curlist(listid);
selection=devlist('sashelp.devices','printer',
  'Select a device',' ',3);
n=getnitemn(listid,'COUNT');
do i=1 to n;
   descript=getnitemc(listid,'DESC',i);
   device=getnitemc(listid,'DEVICE',i);
   devtype=getnitemc(listid,'TYPE',i);
   put descript= device= devtype=;
end;

See Also

COLORLIST


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.