? | ??

?|??

Display one or more values to the console

Syntax

       ? | ?? [<exp list>]

Arguments

<exp list> is a list of values to display and can be any combination of data types, including memo.

If you specify no argument and use the ? command, a carriage return/linefeed is sent to the console. If you use the ?? command without arguments, nothing happens.

Description

? and ?? are console commands that display the results of one or more expressions, separated by a space, to the console. These commands are also command synonyms for the QOUT() and QQOUT() functions, respectively.

Although functionally similar, ? and ?? differ slightly. ? sends a carriage return/linefeed to the console before displaying the results of the expression list. ?? displays output at the current screen cursor or printhead position. This lets you use successive ?? commands to display output to the same line.

A ? or ?? command locates the cursor or printhead one position to the right of the last character displayed. If SET PRINTER is OFF, ROW() and COL() are updated to reflect the new cursor position. If SET PRINTER is ON, PROW() and PCOL() are updated with the new printhead position.

If output from a ? or ?? command reaches the edge of the screen as reported by MAXCOL(), it wraps to the next line. If the output reaches the bottom of the screen as reported by MAXROW(), the screen scrolls up one line.

You can echo output from the ? or ?? commands to the printer by specifying a SET PRINTER ON command before beginning output. You can echo output from both of these commands to a text file using SET ALTERNATE TO <xcFile> to create the file, and SET ALTERNATE ON to begin echoing to the file. Like other console commands, SET CONSOLE OFF suppresses the display to the screen without affecting output to the printer or text file.

To format any expression specified, use TRANSFORM() or a user-defined function. If you need to pad a variable length value for column alignment, use any of the PAD() functions to left-justify, right- justify, or center the value. See the examples below.

Examples

       .  This example prints a record from a database file using ? and
          ?? commands with PADR() to ensure column alignment:
       LOCAL nPage := 0, nLine := 99
       USE Salesman INDEX Salesman NEW
       SET PRINTER ON
       SET CONSOLE OFF
       DO WHILE !EOF()
          IF nLine > 55
             IF nPage != 0
                EJECT
             ENDIF
             ? PADR("Page", LTRIM(STR(nPage++)), 72)
             ?? DTOC(DATE())
             ?
             ?
             ? PADC("Sales Listing", 79)
             ?
             nLine := 5
          ENDIF
          ? Name, Address, PADR(RTRIM(City) + "," ;
                + State, 20), ZipCode
          nLine++
          SKIP
       ENDDO
       SET CONSOLE ON
       SET PRINTER OFF
       CLOSE Salesman

Seealso

@…SAY, PAD(), QOUT(), SET ALTERNATE, SET CONSOLE, SET PRINTER

SP_SL_WRAP

SL_WRAP()

  Short:
  ------
  SL_WRAP() Sets line wrapping on or off

  Returns:
  --------
  cCode => control string to send to the printer

  Syntax:
  -------
  SL_WRAP(lSet)

  Description:
  ------------
  Sets line wrapping on (.t.) or off (.f.) with <lSet>

  Examples:
  ---------
   ?SL_WRAP(.T.)  // set line wrapping on

  Notes:
  -------
  Does not send anything to the printer - instead
  returns a control string that you send to the printer. String can be
  sent with ? or ?? or  QOUT() or QQOUT().

  For HP and compatible(PCL) Laserjet printers.

  Source:
  -------
  S_HPLAS.PRG

 

SP_SL_VLINE

SL_VLINE()

  Short:
  ------
  SL_VLINE() Draws a vertical line from row,col to endrow,col

  Returns:
  --------
  cCode => control string to send to the printer

  Syntax:
  -------
  SL_VLINE(nTop,nLeft,nBottom,nRight,[cShade],[nDPIThick],[nLpi])

  Description:
  ------------
  Draws a vertical line from <nTop,nLeft> to <nBottom,nRight>. Based
  on rows and columns.

  [cShade] refers to the density of the line.

  The shading percentages are (default "100" - black) :

         "1 thru 2" = 2% shade
        "3 thru 10" = 10% shade
       "11 thru 20" = 20% shade
       "21 thru 35" = 30% shade
       "36 thru 55" = 45% shade
       "56 thru 80" = 70% shade
       "81 thru 99" = 90% shade
              "100" = 100% shade

  [nDPIThick] is the thickness in DotsPerInch of the
  line. Default is 2.

  [nLpi] is the lines per inch, and defaults to 6.

  Examples:
  ---------
   ??SL_VLINE(10,20,10,10,"50")  // draws a line 10,10 to 20,10 with
                                          // 50% shading

  Notes:
  -------
  Does not send anything to the printer - instead
  returns a control string that you send to the printer. String can be
  sent with ? or ?? or  QOUT() or QQOUT().

  For HP and compatible(PCL) Laserjet printers.

  Source:
  -------
  S_HPLAS.PRG

 

SP_SL_UNDEROFF

SL_UNDEROFF()

  Short:
  ------
  SL_UNDEROFF() Sets automatic text underlining off

  Returns:
  --------
  cCode => control string to send to the printer

  Syntax:
  -------
  SL_UNDEROFF()

  Description:
  ------------
  Sets automatic text underlining off

  Examples:
  ---------
   ?"Now I am "+SL_UNDER()+"REALLY"+SL_UNDEROFF()+" mad!"

  Notes:
  -------
  Does not send anything to the printer - instead
  returns a control string that you send to the printer. String can be
  sent with ? or ?? or  QOUT() or QQOUT().

  For HP and compatible(PCL) Laserjet printers.

  Source:
  -------
  S_HPLAS.PRG

 

SP_SL_UNDER

SL_UNDER()

  Short:
  ------
  SL_UNDER() Sets automatic text underlining on

  Returns:
  --------
  cCode => control string to send to the printer

  Syntax:
  -------
  SL_UNDER()

  Description:
  ------------
  Sets automatic text underlining on

  Examples:
  ---------
   ?"Now I am "+SL_UNDER()+"REALLY"+SL_UNDEROFF()+" mad!"

  Notes:
  -------
  Does not send anything to the printer - instead
  returns a control string that you send to the printer. String can be
  sent with ? or ?? or  QOUT() or QQOUT().

  For HP and compatible(PCL) Laserjet printers.

  Source:
  -------
  S_HPLAS.PRG

 

SP_SL_TOPMARG

SL_TOPMARG()

  Short:
  ------
  SL_TOPMARG() Designates the number of lines of top margin

  Returns:
  --------
  cCode => control string to send to the printer

  Syntax:
  -------
  SL_TOPMARG(nLines)

  Description:
  ------------
  Designates the number of lines of top margin <nLines>

  Examples:
  ---------
   ?SL_TOPMARG(3) // sets top margin to 3

  Notes:
  -------
  Does not send anything to the printer - instead
  returns a control string that you send to the printer. String can be
  sent with ? or ?? or  QOUT() or QQOUT().

  For HP and compatible(PCL) Laserjet printers.

  Source:
  -------
  S_HPLAS.PRG

 

SP_SL_SETLPI

SL_SETLPI()

  Short:
  ------
  SL_SETLPI() Sets the lines per inch for the laserjet

  Returns:
  --------
  cCode => control string to send to the printer

  Syntax:
  -------
  SL_SETLPI(nLPI)

  Description:
  ------------
  Sets the lines per inch for the laserjet to <nLpi>
  which  can be:

  1 - 1 line/inch
  2 - 2 line/inch
  3 - 3 line/inch
  4 - 4 line/inch
  6 - 6 line/inch
  8 - 8 line/inch
  12-12 line/inch
  16-16 line/inch
  24-24 line/inch
  48-48 line/inch

  Examples:
  ---------
   cCode := SL_SETLPI(6)     // sets LPI to 6 - the default

   ?cCode

  Notes:
  -------
  Does not send anything to the printer - instead
  returns a control string that you send to the printer. String can be
  sent with ? or ?? or  QOUT() or QQOUT().

  For HP and compatible(PCL) Laserjet printers.

  Source:
  -------
  S_HPLAS.PRG