Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 1.18 KB

File metadata and controls

28 lines (19 loc) · 1.18 KB

SET DEVICE, Set("Device"), Sys(101)

This group is more old Xbase baggage. SET DEVICE lets you redirect the output of @ .. SAYs while the two functions tell where that output is going at the moment.

Usage

SET DEVICE TO SCREEN | PRINTER [ PROMPT ] | FILE FileName
cCurDevice = SET( "DEVICE" [, 1 ] )
cCurDevice = SYS( 101 )

Once upon a time, the @ .. SAY command was one way to produce reports. By twiddling the DEVICE setting, you could have the report appear either on screen, on paper or in a file. With SET("DEVICE") or SYS(101), you could even remember how it was set beforehand and restore it. If you designate a file destination, SET("DEVICE") returns "FILE" and SET("DEVICE",1) returns the destination filename.

In Visual FoxPro, @ .. SAY is a terrible way to produce reports, so there's not much reason to touch the DEVICE setting.

Incidentally, if you SET DEVICE TO PRINT, the actual output location is controlled by the setting of SET PRINT TO.

Example

SET DEVICE TO PRINT
* Issue @ .. SAYs to send a report to the printer
SET DEVICE TO SCREEN

See Also

@...Say, Set, Set Print