• No results found

Command Reference

In document xHarbour Language Reference Guide (Page 189-198)

? | ??

? | ??

Displays values of expressions to the console window.

Syntax

? [<expression,...>]

?? [<expression,...>]

Arguments

<expression,...>

<expression> is an optional, comma separated list of expressions whose values are output.

When no expression is specified, the ? command outputs a new line while ?? outputs nothing.

Description

The ? and ?? commands are text mode console commands that display the result of a comma separated list of expressions to the currently selected output device. This can be the screen, or console window or the printer. The functional equivalent of both commands are the QOut() and QQOut() functions.

The difference between ? and ?? is that the ? command first outputs a carriage-return/line-feed pair so that the output of <expression,...> always begins at a new line, while ?? outputs the values of

<expression,...> at the current cursor or printhead position.

The ? or ?? command first locates the current cursor or printhead position and shifts it one to the right.

Row() and Col() are updated with the new cursor position if SET PRINTER is OFF, otherwise they are updated with the new printhead position.

Should the output of ? or ?? reach the right border of the screen (defined by MaxCol()), it will wrap to the next line. Should the output of ? or ?? reach the bottom border of the screen (defined by

MaxRow()), the screen will scroll up one line.

It is possible to output the expression(s) to the printer by using the SET PRINTER ON before using the

? or ?? command. It is also possible to output to a text file using the SET ALTERNATE TO command, followed by the SET ALTERNATE ON command. The SET CONSOLE OFF command will prevent display on the screen without interrupting the output to the printer or text file.

When the expression(s) need formatting, use the Transform() function or any user-defined function.

For padding, use any of the Pad() functions to center, left align or right align the expression(s).

Info

See also: @...SAY,PadC() | PadL() | PadR(),QOut() | QQOut(),SET ALTERNATE,SET CONSOLE,SET DEVICE,SET PRINTER,Transform()

Category: Console commands Source: rtl\console.c

LIB: xhb.lib

DLL: xhbdll.dll

Example

// This example displays a list of expressions:

PROCEDURE Main

LOCAL var1 := 1, var2 := Date(), var3 := .T.

? | ??

? "This line will be displayed on the console."

? "This line will be displayed beneath the previous line."

?? "No carriage return / linefeed for this expression!"

? var1, var2, var3, "These were variables"

RETURN

@...BOX

@...BOX

Displays a box on the screen.

Syntax

@ <nTop>, <nLeft>, <nBottom>, <nRight> BOX <cBoxString> ; [COLOR <cColor>]

Arguments

<nTop> and <nLeft>

Numeric values indicating the screen coordinates for the upper left corner of the @...BOX output.

<nBottom> and <nRight>

Numeric values indicating the screen coordinates for the lower right corner of the @...BOX output.

<cBoxString>

The appearance of the box to display is as a character string holding up to nine characters. The first eight characters define the border of the box while the ninth character is used to fill the box.

#define constants to be used for <cBoxString> are available in the BOX.CH #include file.

Pre-defined box strings for @...BOX

Constant Description

B_SINGLE Single-line box

B_DOUBLE Double-line box

B_SINGLE_DOUBLE Single-line top, double-line sides B_DOUBLE_SINGLE Double-line top, single-line sides

<cColor>

An optionalSetColor()compliant color string can be specified to draw the box. It defaults to the standard color of SetColor().

Description

The @...BOX command displays a box on the screen as specified with <cBoxString>, using the standard color of SetColor() or <cColor>, if specified.

The first eight characters of the string <cBoxString> define the border of the box in clockwise direction, beginning with the upper left cor ner. An optional nineth character fills the area inside the box. Alternatively, a single character can be passed which is used to draw the entire box border.

When the box is completely drawn, the cursor is positioned at the coordinates <nTop>+1 and

<nLeft>+1, so thatRow()andCol()can be used to start displaying text in the upper left corner of the box area.

@...BOX

Info

See also: @...CLEAR,@...SAY,@...TO,DispBox(),Scroll() Category: Output commands

Header: box.ch

LIB: xhb.lib

DLL: xhbdll.dll

Example

// The example demonstrates how characters are used to draw a box.

// Alphabetic characters define <cBoxString> instead of characters // holding graphic signs.

#include "Box.ch"

PROCEDURE Main CLS

@ 10, 10, 20, 50 BOX "AbCdEfGhi" COLOR "W+/R"

Inkey(0)

@ 10, 10, 20, 50 BOX B_DOUBLE + Space(1)

@ Row(), Col() SAY "Using #define constant"

@ MaxRow()-1, 0 RETURN

@...CLEAR

@...CLEAR

Clears the contents of the screen.

Syntax

@ <nTop>, <nLeft> [ CLEAR [TO <nBottom>, <nRight>] ]

Arguments

@ <nTop>, <nLeft>

Numeric values indicating the screen coordinates for the upper left corner of the @...CLEAR command. If the CLEAR option is not used, only one row of the screen is cleared from the position <nRow>, <nCol> to the rightmost column.

CLEAR

When this option is used, a rectangular area on the screen is cleared, beginning at <nTop> and

<nLeft> down to <nBottom> and <nRight>.

TO <nBottom>, <nRight>

Numeric values indicating the screen coordinates for the lower right corner of the @...CLEAR command. <nBottom> defaults toMaxRow()and <nRight> defults toMaxCol(). Both parameters require the CLEAR option be used.

Description

The @...CLEAR command is used to clear a rectangular area on the screen in text mode applications.

This is accomplished by displaying white space characters in the specified region using the standard color value ofSetColor().

After the screen is cleared, the cursor is positioned at the top, left corner of the cleared rectangle. The new cursor position is reflected by theRow()andCol()functions.

Info

See also: @...BOX,CLEAR SCREEN,DispBox(),Scroll(),SetColor(),SetPos() Category: Output commands

Source: rtl\scroll.c, rtl\setpos.c

LIB: xhb.lib

DLL: xhbdll.dll

Example

// The example demonstrates various possibilities of // erasing the screen and parts thereof.

PROCEDURE Main

SetColor( "W+/B" ) CLEAR SCREEN SetColor( "W+/R" )

@ 2, 0 // deletes the second row

@...CLEAR

@ 20, 40 CLEAR // erase area to bottom/right

@ 5, 30 CLEAR TO 15, 55 // use all four coordinates RETURN

@...GET

@...GET

Creates a Get object (entry field) and displays it to the screen

Syntax

@ <nRow>, <nCol> ;

[SAY <xSay> [PICTURE <cSayPict>] COLOR <cSayColor>] ; GET <xVar> [PICTURE <cGetPict>] [COLOR <cGetColor>] ; [WHEN <lWhen>] ;

[VALID <lValid> | RANGE <xMinVal>, <xMaxVal> ] ; [MESSAGE <cMessage> ] ;

[SEND <msg>]

Arguments

@ <nRow>, <nCol>

The parameters are numeric values specifying the row and column coordinates for the screen output. The range for rows on the screen is 0 to MaxRow(), and for columns it is 0 to MaxCol().

The coordinate 0,0 is the upper left corner of the screen.

SAY <xSay>

This is a value of data type C, D, L or N which is displayed in front of the Get object. It is typically a character string indicating the name of the entry field.

PICTURE <cSayPict>

If specified, <cSayPict> is a character string holding the PICTURE format to be used for displaying <xSay>.

COLOR <cSayColor>

The parameter <cSayColor> is an optional character string defining the color for the output of

<xSay>. It defaults to the currentSetColor()setting. When <cSayColor> is specified as a literal color string, it must be enclosed in quotes.

GET <xVar>

This is a memory of field variable holding the value to be edited by the user, PICTURE <cGetPict>

If specified, <cSayPict> is a character string holding the PICTURE format to be used for display and editing of <xVar>.

COLOR <cGetColor>

The parameter <cGetColor> is an optional character string defining the colors for the display and editing of <xVar>. It defaults to the currentSetColor()setting. The first color value is used for the display of <xVar>, while the second defines the editing color. When <cGetColor> is specified as a literal color string, it must be enclosed in quotes.

WHEN <lWhen>

This is a logical expression or a code block returning a logical value. If specified, <lWhen>

must result in .T. (true) to allow editing. If the expression yields .F. (false), the Get object is not editable but skipped.

@...GET VALID <lValid>

This is a logical expression or a code block returning a logical value. If specified, <lValid> must result in .T. (true) to end editing. When the result is .F. (false), the currently edited value of

<xVar> is invalid and the user cannot leave the Get object unless editing is cancelled.

RANGE <xMinVal>, <xMaxVal>

When the value of <xVar> is numeric or a Date, the minimum and maximum values allowed for

<xVar> can be specified with the RANGE clause. Note that RANGE and VALID are mutually exclusive.

MESSAGE <cMessage>

This is an optional character string displayed in the message row when a Get object is active.

The message row is defined with the MSG AT option of theREADcommand.

SEND <msg>

This is an optional message to be sent to the Get object before it is displayed. Refer to theGet classfor possible messages that can be sent to the Get object.

Description

The @...GET command creates a new object of the Get class, adds it to the GetList array and displays it to the screen. The GetList array is a default PUBLIC varible that is reserved for being used by the Get system. It is recommended, however, to declare a new variable named GetList and initialize it with an empty array before the first @...GET command is issued. The value to be edited is held in the variable <xVar>.

If the SAY clause is used, <xSay> is displayed at the screen position <nRow>, <nCol>, followed by the value of <xVar>. The PICTURE <cSayPict> clause optionally specifies a picture format string for the display of <xSay>, while the COLOR <cSayColor> defines the color. Refer toSetColor()and Transform()for color values and picture formatting of the SAY clause.

If PICTURE <cGetPict> is specified, it defines the picture formatting of <xVar> for display and editing. See the table below for these picture formatting rules.

If the WHEN clause is specified, it determines wether or not a Get object can receive input focus during theREADcommand. The <lWhen> expression must be a logical expression or a code block returning a logical value. If <lWhen> yields .T. (true) the corresponding Get object receives input during READ. When it is .F. (false) this Get object is skipped during READ.

The VALID clause is similar to the WHEN clause, but it is evaluated during the READ command before the user advances to the next get object, i.e. before the current Get object looses input focus. If

<lValid> yields .T. (true), the next Get object receives input focus. Otherwise, the input focus remains with the current Get object and the user must change the edited value until <lValid> results in .T.

(true), or editing is cancelled.

Instead of the VALID clause, the RANGE option can be used for numeric values and Dates. The minimum and maximum value valid for <xVar> must then be specified with <xMinVal> and

<xMaxVal>.

The PICTURE clause <cGetPict> defines the formatting of <xVar> for display and editing. It is a character string defining a picture function and/or template. A picture function begins with the @ character. If the picture string contains both, the picture function must appear first, followed by a blank space and the template characters.

@...GET

In document xHarbour Language Reference Guide (Page 189-198)