xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

SET DEVICE

Selects the ouput device for @...SAY commands.

Syntax

SET DEVICE TO SCREEN | printer

Arguments

TO SCREEN
This outputs all @...SAY commands to the screen. The output is not influenced by the SET PRINTER and SET CONSOLE settings.
TO PRINTER
Outputs all @...SAY commands to the device set with SET PRINTER TO. Possible devices are local printer, network printer or a file.

Description

The SET DEVICE command sends the output of @...SAY commands either to the screen, or a printer. When SET DEVICE TO PRINTER is used, no output is displayed on the screen. The @...SAY command respects the settings set by SET MARGIN.

When the output is send to the printer, an automated EJECT is performed when the current printhead row position is less than the last print row position. When such an EJECT is executed, PCol() and PRow() values are set to zero. To The SetPRC() function can then be used to initialize PCol() and PRow() with new values.

To direct the output of @...SAY to a file, use SET PRINTER TO <fileName> and SET DEVICE TO PRINTER.

Info

See also:@...SAY, EJECT, PCol(), PRow(), Set(), SET PRINTER, SetPrc()
Category: Output commands
Source:rtl\set.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example demonstrates how to direct the output of @...SAYs
// to the printer and to a file:

   PROCEDURE Main
      SET DEVICE TO PRINTER
      @ 2,10 SAY "Hello there"
      EJECT

      SET PRINTER TO MyOutputFile.txt
      SET DEVICE TO PRINTER
      @ 10, 10 SAY "Current file is MyOutputFile.txt"

      SET PRINTER TO
      SET DEVICE TO SCREEN
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe