Version()

Version()

Returns the HARBOUR Version or the Harbour/Compiler Version.

Syntax

      Version()  --> <cReturn>

Arguments

None

Returns

<cReturn> String containing the Harbour Version

Description

This function returns the current Harbour Version.

Examples

      ? Version() // "Harbour Terminal: Standard stream console"

Compliance

Clipper

Platforms

All

Files

Library is core

Seealso

OS()

Tone()

Tone()

Sound a tone with a specified frequency and duration.

Syntax

      Tone( <nFrequency>,  <nDuration> ) --> NIL

Arguments

<nFrequency> A non-negative numeric value that specifies the frequency of the tone in hertz.

<nDuration> A positive numeric value which specifies the duration of the tone in 1/18 of a second units.

Returns

Tone() always returns NIL.

Description

Tone() is a sound function that could be used to irritate the end user, his or her dog, and the surrounding neighborhood. The frequency is limited to the range 0 to 32767 Hz.

Examples

      IF lOk   // Good Sound
         Tone(  500,  1 )
         Tone( 4000,  1 )
         Tone( 2500,  1 )
      ELSE     // Bad Sound
         Tone(  300,  1 )
         Tone(  499,  5 )
         Tone(  700,  5 )
      ENDIF
      //
      Tone( 800,  1 )                         // same as ? Chr( 7 )
      Tone( 32000,  200 )                     // any dogs around yet?
      Tone( 130.80,  1 )                      // musical note - C
      Tone( 400,  0 )                         // short beep
      Tone( 700 )                            // short beep
      Tone( 10,  18.2 )                       // 1 second delay
      Tone( -1 )                             // 1/18.2 second delay
      Tone()                                 // 1/18.2 second delay

Compliance

Clipper

Platforms

All

Files

Library is core

Seealso

Chr(), SET BELL

RUN

RUN

Run an external program.

Syntax

      RUN <cCommand>

Arguments

<cCommand> Command to execute.

Description

This command runs an external program. Please make sure that you have enough free memory to be able to run the external program. Do not use it to run Terminate and Stay Resident programs (in case of DOS) since that causes several problems.

Examples

      RUN ( "edit " + cMyTextFile )  // Runs an external editor
      RUN command                    // Gives a DOS shell (DOS only)

Compliance

Clipper

Platforms

All

Files

src/rtl/run.c Library is rtl

Seealso

RUN

OS()

OS()

Return the current operating system.

Syntax

      OS() --> <cOperatingSystem>

Returns

<cOperatinSystem> The current operating system.

Description

This function will return the current operating system.

Examples

      ? OS()

Compliance

Clipper

Platforms

All

Files

src/rtl/version.c

hb_GetEnv()

HB_GETENV()

Obtains a system environmental setting.

Syntax

      HB_GETENV(<cEnviroment>, [<cDefaultValue>], [<lApplyCodepage>] )
                   --> <cReturn>

Arguments

<cEnviroment> Enviromental variable to obtain.

<cDefaultValue> Optional value to return if <cEnvironment> is not found.

<lApplyCodepage> optional logical parameter specifing whether to apply automatic codepage conversion (to the codepage specified by Set( _SET_OSCODEPAGE ) on the obtained value. The default is .T. Note that if the default value is passed and the environment value is not found, this codepage conversion is not performed against the returned default value

Returns

<cReturn> Value of the environment variable or <cDefaultValue> or an empty string.

Description

This function yields a string that is the value of the environment variable <cEnviroment>, which is stored at the system level.

If no environment variable can be found, the value of the function will be <cDefaultValue> if it is passed, else an empty string.

Examples

      ? HB_GETENV( "PATH" )
      ? HB_GETENV( "CONFIG" )
      ? HB_GETENV( "HARBOURCMD", "-n -l -es2" )

Compliance

Harbour

Platforms

All

Files

src/rtl/gete.c Library is rtl

Seealso

GETENV, GETE

GetEnv()

Template

Function

Name

GetEnv()

Category

API

Subcategory

Environment

Oneliner

Obtains a system environmental setting.

Syntax

      GetEnv( <cEnviroment> )  --> <cReturn>

Arguments

<cEnviroment> Enviromental variable to obtain.

Returns

<cReturn> Value of the Environment Variable.

Description

This function yields a string that is the value of the environment variable <cEnviroment>, which is stored at the system level.

If no environment variable is found, an empty string is returned.

Examples

      ? GetEnv( "PATH" )
      ? GetEnv( "CONFIG" )
      ? GetEnv( "HARBOURCMD",  "-n -l -es2" )

Compliance

Clipper

Platforms

All

Files

Library is core

Seealso

GetE()

GetE()

GETE()

Obtains a system environmental setting.

Syntax

      GETE(<cEnviroment> )  --> <cReturn>

Arguments

<cEnviroment> Enviromental variable to obtain.

Returns

<cReturn> Value of the Environment Variable.

Description

This function yields a string that is the value of the environment variable <cEnviroment>, which is stored at the system level.

If no environment variable is found, an empty string is returned.

Examples

      ? GETE( "PATH" )
      ? GETE( "CONFIG" )
      ? GETE( "HARBOURCMD", "-n -l -es2" )

Compliance

This is CA-Cl*pper compliant.

The <cDefaultValue> parameter is a Harbour extension.

Platforms

All

Files

src/rtl/gete.c Library is rtl

Seealso

GETENV

__Run()

Template

Procedure

Name

__Run()

Category

API

Subcategory

Environment

Oneliner

Run an external program.

Syntax

      __Run( <cCommand> )

Arguments

<cCommand> Command to execute.

Description

This command runs an external program. Ensure that you have enough free memory to be able to run the external program. Do not use it to run ‘Terminate and Stay Resident’ programs (in case of MS-DOS) since that causes several problems.

Note: This function is what the RUN command preprocesses into. It is considered bad form to use this function directly. Use the RUN command instead.

Examples

      __Run( "edit " + cMyTextFile )    // Runs an external editor
      __Run( "command" )                // Gives a OS shell

Compliance

Clipper

Platforms

All

Files

Library is core

Seealso

RUN

MENU TO

MENU TO

Invoked a menu defined by set of @…PROMPT

Syntax

      MENU TO <cVariable>

Arguments

<cVariable> is a character string that contain the name of the variable to hold the menu choices, if this variable does not exist a PRIVATE variable with the name <cVariable> would be created to hold the result.

Description

Menu To() invoked the menu define by previous __AtPrompt() call and display a highlight bar that the user can move to select an option from the menu. If <cVariable> does not exist or not visible, a PRIVATE variable named <cVariable> is created and hold the current menu selection. If there is a variable named <cVariable>, its value is used to select the first highlighted item.

Menu prompts and messages are displayed in current Standard color, highlighted bar is displayed using current Enhanced color.

Pressing the arrow keys move the highlighted bar. When a menu item is highlighted the message associated with it is displayed on the line specified with SET MESSAGE. If SET WRAP is ON and the user press UP arrow while on the first selection the last menu item is highlighted, if the user press Down arrow while on the last item, the first item is highlighted.

Following are active keys that handled by Menu To:

       key            Meaning
       -------------- ---------------------------------
       Up             Move to previous item
       Down           Move to next item
       Left           Move to previous item
       Right          Move to next item
       Home           Move to the first item
       End            Move to the last item
       Page-Up        Select menu item, return position
       Page-Down      Select menu item, return position
       Enter          Select menu item, return position
       Esc            Abort selection, return 0
       First letter   Select next menu with the same first letter,
                      return this item position.

Upon exit the cursor is placed at MaxRow()-1, 0 Menu To can be nested without loosing the previous prompts.

MENU TO command is preprocessed into __MenuTo() function during compile time.

Examples

      // display menu item on each screen corner and let user select one
      CLS
      SET MESSAGE TO MaxRow() / 2 CENTER
      SET WRAP ON
      @ 0           , 0             PROMPT "1. Upper left"   MESSAGE " One "
      @ 0           , MaxCol() - 16 PROMPT "2. Upper right"  MESSAGE " Two "
      @ MaxRow() - 1, MaxCol() - 16 PROMPT "3. Bottom right" MESSAGE "Three"
      @ MaxRow() - 1, 0             PROMPT "4. Bottom left"  MESSAGE "Four "
      MENU TO nChoice
      SetPos( MaxRow() / 2, MaxCol() / 2 - 10 )
      IF nChoice == 0
         ?? "Esc was pressed"
      ELSE
         ?? "Selected option is", nChoice
      ENDIF

Compliance

Clipper

Seealso

@…PROMPT, ACHOICE(), SET MESSAGE, SET INTENSITY, SET WRAP, __ATPROMPT()

AChoice()

 

ACHOICE()

Allows selection of an element from an array

Syntax

      ACHOICE(<nTop>, <nLeft>, <nBottom>, <nRight>,;
              <acMenuItems>, [<alSelableItems> | <lSelableItems>],;
              [<cUserFunction> | <bUserBlock>], [<nInitialItem>],;
              [<nWindowRow>]) --> nPosition

Arguments

<nTop> – topmost row used to display array (default 0)

<nLeft> – leftmost row used to display array (default 0)

<nBottom> – bottommost row used to display array (default MaxRow())

<nRight> – rightmost row used to display array (default MaxCol())

<acMenuItems> – the character array of items from which to select

<alSelableItems> – an array of items, either logical or character, which is used to determine if a particular item may be selected. If the type of a given item is character, it is macro evaluated, and the result is expected to be a logical. A value of .T. means that the item may be selected, .F. that it may not. (See next argument: lSelectableItems)

<lSelableItems> – a logical value which is used to apply to all items in acMenuItems. If .T., all items may be selected; if .F., none may be selected. (See previous argument: alSelectableItems) Default .T.

<cUserFunction> – the name of a function to be called which may affect special processing of keystrokes. It is specified without parentheses or parameters. When it is called, it will be supplied with the parameters: nMode, nCurElement, and nRowPos. Default NIL.

<bUserBlock> – a codeblock to be called which may affect special processing of keystrokes. It should be specified in the form {| nMode, nCurElemenet, nRowPos | ; MyFunc( nMode, nCurElemenet, nRowPos ) }. Default NIL.

<nInitialItem> – the number of the element to be highlighted as the current item when the array is initially displayed. 1 origin. Default 1.

<nWindowRow> – the number of the window row on which the initial item is to be displayed. 0 origin. Default 0.

Returns

<nPosition> – the number of the item to be selected, or 0 if the selection was aborted.

Description

Allows selection of an element from an array. Please see standard CA-Cl*pper documentation for ACHOICE for additional detail.

Examples

      aItems := { "One", "Two", "Three" }
      nChoice := AChoice( 10, 10, 20, 20, aItems )
      IF nChoice == 0
         ? "You did not choose an item"
      ELSE
         ? "You chose element " + hb_ntos( nChoice )
         ?? " which has a value of " + aItems[ nChoice ]
      ENDIF

Files

Library is rtl

Compliance

Clipper

Seealso

MENU TO