xHarbour Reference Documentation > Function Reference |
Retrieves or changes a system setting.
Set( <nDefine>, [<xNewSetting>], [<xOption>] ) --> xOldSetting
The function returns the value of the specified system setting which is set before the function is called.
Set() is a universal function managing numerous system settings available in xHarbour. Many of these settings can be changed via SET commands, which is the recommended way. To query the current value of a system setting, however, must be done by calling the Set() function.
This function accepts as first parameter a #define constant, which identifies the system setting to query or change. The available constants are listed in alphabetical order below:
_SET_ALTERNATE | <lOnOff> | on | OFF See also: command SET ALTERNATE. If the setting is enabled, functions QOut() | QQout() write to the screen and to a file, provided that a file is opened or created with _SET_ALTFILE. If disabled, which is the default, Qout() and QQout() only write to the screen (and/or to the PRINTFILE). |
_SET_ALTFILE | <cFileName> , <lAdditive> See also: command SET ALTERNATE. When set, creates or opens file to write Qout() and QQout() output to. If .T. (true) is passed for <lAdditive> (=third parameter of Set()) and the file already exists, the file is opened and positioned at the end of file, so that new output is appended to the existing file. Otherwise, the file is created. If a file is already opened, it is closed before the new file is opened or created (even if it is the same file). The default file extension is ".txt". There is no default file name. Call with an empty string to close the file. |
_SET_AUTOPEN | <lOnOff> | ON | off See also: command SET AUTOPEN. When set, opens a structural index file automatically with the USE command, when the index file has the same filename (without extension) as the database file. Default is enabled. Note: this setting must be supported by the replaceble database driver. DBFCDX supports this setting, for example. It opens the structural index file. To automatically select an index of that file, _SET_AUTORDER must be set. |
_SET_AUTORDER | <nOrdPos> See also: command SET AUTORDER. When set, and _SET_AUTOPEN is set to .T. (true), the RDD selects automatically the index at position <nOrdPos> as current index. The default is 0, i.e. no index is selected as current, although the index file may be open. Note: this setting must be supported by the replaceble database driver. DBFCDX supports this setting, for example. |
_SET_AUTOSHARE | <nShareMode> See also: command SET AUTOSHARE. The default value is zero, causing an application not to use automatic SHARE mode detection when databases are opened. The value 1 means, the application detects if it runs in a network. If it does not, all database access is done EXCLUSIVE. If <nShareMode> is set to 2, databases are always opened in EXCLUSIVE mode. |
_SET_BACKGROUNDTASKS | <lOnOff> | on | OFF See also: command SET BACKGROUND TASKS. When enabled, background tasks are active. When disabled, which is the default, tasks are inactive. |
_SET_BACKGROUNDTICK | <nInterval> See also: command SET BACKGROUNDTICK. This setting is the number of xHarbour pCodes to execute before background tasks are checked to run. The default value for <nInterval> is 1000. When this value is enlarged, the system saves time for task checking. Reducing the value improves the response time for background tasks. |
_SET_BELL | <lOnOff> | on | OFF See also: command SET BELL. When enabled, the bell sounds when the last position of a GET entry field is reached and/or when a GET validation fails. Disabled by default. |
_SET_CANCEL | <lOnOff> See also: function SetCancel(). When enabled, which is the default, pressing Alt+C or Ctrl+Break terminates the program. When disabled, both keystrokes can be read by Inkey(). Note: _SET_KEY has precedence over _SET_CANCEL. |
_SET_COLOR | <cColorString> See also: function SetColor(). This setting exists for compatibility reasons. It is superseeded by function SetColor(). |
_SET_CONFIRM | <lOnOff> | on | OFF See also: command SET CONFIRM. If enabled, an exit key must be pressed to leave a GET. If disabled, which is the default, typing past the end will leave a GET. |
_SET_CONSOLE | <lOnOff> | ON | off See also: command SET CONSOLE. If enabled, which is the default, all screen output goes to the console window. When disabled, screen output is suppressed. |
_SET_CURSOR | <nCursorType> See also: function SetCursor(). <nCursorType> is a #define constant from the SetCurs.ch file. It defines the shape of the cursor in a console application. The default is SC_NORMAL. |
_SET_DATEFORMAT | <cDateFormat> | AMERICAN | ansi | British | French | German | Italian | Japan | USA See also: command SET DATE. <cDateFormat> is a character string specifying the date format for displaying Date values. |
_SET_DBFLOCKSCHEME | <nLockScheme> Refer to command SET DBFLOCKSCHEME for a comprehensive description of this setting. |
_SET_DEBUG | <lOnOff> When set to .T., pressing Alt+D activates the debugger. When set to .F., which is the default, Alt+D can be read by Inkey(). This setting is also affected by AltD(1) and AltD(0). |
_SET_DECIMALS | <nDecimals> See also: command SET DECIMALS. Sets the number of decimal digits to use for displaying or printing numeric values when SET FIXED is ON. Defaults to 2. If SET FIXED is OFF, then SET DECIMALS is only used to determine the number of decimal digits to use after using Exp(), Log(), SQrt(), or division. Other math operations may adjust the number of decimal digits that the result will display. Note: This never affects the precision of a number. Only the display format is affected. |
_SET_DEFAULT | <cPath> See also: command SET DEFAULT. Sets the default directory in which to open, create and check for database and index files. Defaults to the current directory (empty string). |
_SET_DELETED | <lOnOff> | on | OFF See also: command SET DELETED. If enabled, records marked for deletion are not visible. If disabled, which is the default, deleted records are visible. |
_SET_DELIMCHARS | <cDelimiters> "::" See also: command SET DELIMITERS. Sets the GET delimiter characters. Defaults to "::". |
_SET_DELIMITERS | <lOnOff> | on | OFF See also: command SET DELIMITERS. If enabled, GETs are delimited on screen. If disabled, which is the default, no GET delimiters are used. |
_SET_DEVICE | SCREEN | print See also: command SET DEVICE. Selects the output device for DEVOUT(). When set to "PRINTER", all output is sent to the printer device or file set by _SET_PRINTFILE. When set to anything else, all output is sent to the screen. Defaults to "SCREEN". |
_SET_DIRCASE | <nCaseMode> See also: command SET DIRCASE. This setting controls how the directory name will be acessed on disk. If 0 is specified, which is the default, mixed case letters are allowed. If 1 is speficied, lower case letters are used, also, converts all letters to lower case. If 2 is speficied, upper case letter are used, also, converts all letters to upper case. |
_SET_DIRSEPARATOR | <cDirSeparator> See also: command SET DIRSEPARATOR. This setting specifies a single character to be used as path separator. Default is the backslash "\". |
_SET_EOL | <cEndOfLineChars> See also: command SET EOL. This setting specifies the end-of-line character(s) used by an xHarbour application. It defaults to Crarriage Return plus Line Feed (Chr(13)+Chr(10)). |
_SET_EPOCH | <nYear> (1900) See also: command SET EPOCH. Determines how to handle the conversion of 2-digit years to 4 digit years. When a 2-digit year is greater than or equal to the year part of the epoch, the century part of the epoch is added to the year. When a 2-digit year is less than the year part of the epoch, the century part of the epoch is incremented and added to the year. The default epoch is 1900, which converts all 2-digit years to 19xx. Example: If the epoch is set to 1950, 2-digit years in the range from 50 to 99 get converted to 19xx and 2-digit years in the range 00 to 49 get converted to 20xx. |
_SET_ERRORLOG | <cFileName>, <lAppend> See also: command SET ERRORLOG. |
_SET_ERRORLOOP | <nRecursion> See also: command SET ERRORLOOP. This setting defines the recursion depth if recursive errors occur in the xHarbour error handling routine. <nRecursion> is a numeric value that defines the maximume error recursion level after which an xHarbour application terminates. The default value is 8. |
_SET_ESCAPE | <lOnOff> | ON | off See also: command SET ESCAPE. When enabled, which is the default, pressing Esc will exit a READ. When disabled, pressing Esc during a READ is ignored, unless the Esc key has been assigned to a function using SetKey(). |
_SET_EVENTMASK | <nEvents> See also: command SET EVENTMASK. Determines which events function Inkey() responds to. #define constants must be used for <nEvents>. They are listed in the file INKEY.CH. |
_SET_EXACT | <lOnOff> | on | OFF See also: command SET EXACT. When enabled, all string comparisons other than exactly equal (==) exclude trailing spaces when checking for equality. When disabled, which is the default, all string comparisons other than exactly equal treat two strings as equal if the right hand string is "" or if the right hand string is shorter than or the same length as the left hand string and all of the characters in the right hand string match the corresponding characters in the left hand string. |
_SET_EXCLUSIVE | <lOnOff> | on | OFF See also: command SET EXCLUSIVE. When enabled, which is the default, all database files are opened in exclusive mode. When disabled, all database files are opened in shared mode. Note: The EXCLUSIVE and SHARED clauses of the USE override this setting. |
_SET_EXIT | <lOnOff> See also: function ReadExit(). Toggles the use of Up-arrow and Down-arrow as READ exit keys. Specifying true (.T.) enables them as exit keys, and false (.F.) disables them. Used internally by the ReadExit() function. |
_SET_EXTRAFILE | <cFileName> When set, creates or opens a secondary SET ALTERNATE file that receives QOut() and QQOut() output. |
_SET_FILECASE | <nCaseMatch> See also: command SET FILECASE. This setting controls how the file will be acessed on disk. If 0 is specified, mixed case letters are allowed. This is the default setting. If 1 is speficied, lower case letters are used, also, convert all letters to lower case. If 2 is speficied, upper case letters are used, also, convert all letters to upper case. |
_SET_FIXED | <lOnOff> | on | OFF See also: command SET FIXED. When enabled, all numeric values will be displayed and printed with the number of decimal digits set by SET DECIMALS, unless a PICTURE clause is used. When disabled, which is the default, the number of decimal digits that are displayed depends upon a variety of factors. See _SET_DECIMALS for more. |
_SET_HARDCOMMIT | <lOnOff> | on | OFF See also: command SET HARDCOMMIT. When enabled, forces an immediate disk write operation for database and index files when a record is changed. When disabled,which is the default, changes are cached in internal database buffers which are flushed later to a file. |
_SET_IDLEREPEAT | <lOnOff> When enabled, which is the default, idle tasks are repeatedly executed in the background when the application enters an idle state. When disabled, the list of idle tasks is executed only once when the application enters an idle state. |
_SET_INSERT | <lOnOff> When enabled, characters typed in a GET or MemoEdit() are inserted. When disabled, which is the default, characters typed in a GET or MemoEdit() overwrite. Note: This setting can also be toggled between on and off by pressing the Insert key during a GET or MemoEdit(). |
_SET_INTENSITY | <lOnOff> | ON | off When enabled, which is the default, GETs and PROMPTs are displayed using the enhanced color setting. When disabled, GETs and PROMPTs are displayed using the standard color setting. |
_SET_LANGUAGE | <cLangID> See also: function HB_LangSelect(). Specifies the language to be used for xHarbour messages. The default value is "EN". |
_SET_MARGIN | <nColumns> (0) See also: command SET MARGIN. Sets the left margin for all printed output. The default value is 0. Note: PCol() reflects the printer's column position including the margin (e.g., SET MARGIN TO 5 followed by DevPos(5, 10) makes PCol() return 15). |
_SET_MBLOCKSIZE | <nMemoBlockSize> See also: command SET MEMOBLOCK. This setting specifies the default block size for memo fields. If not set, which is the default, the default block size for memo fields is defined by the RDD. |
_SET_MCENTER | <lOnOff> | on | OFF See also: command SET MESSAGE. This setting toggles the CENTER option of the SET MESSAGE command. If enabled, display PROMPTs centered on the MESSAGE row. If disabled, which is the default, display PROMPTs at column position 0 on the MESSAGE row. |
_SET_MESSAGE | <nRow> See also: command SET MESSAGE. If set to 0, which is the default, PROMPTs are always suppressed. Otherwise, PROMPTs are displayed on the set row. Note: It is not possible to display prompts on the top-most screen row, because row 0 is reserved for the SCOREBOARD, if enabled. |
_SET_MFILEEXT | <cMemoFileExtension> See also: command SET MFILEEXT. This setting specifies the default file extension for memo files. If not set, which is the default, the default extension is defined by the RDD. |
_SET_OPTIMIZE | <lOnOff> | ON | off See also: command SET OPTIMIZE. This setting toggles the filter optimization for database navigation in the current work area. |
_SET_PATH | <cPath> ("") See also: command SET PATH. Specifies a path of directories to search through to locate a file that can't be located in the DEFAULT directory. Defaults to no path (""). Directories must be separated by a semicolon (e.g., "C:\DATA;C:\MORE"). |
_SET_PRINTER | <lOnOff> | on | OFF See also: command SET PRINTER. If enabled, QOut() and QQOut() write to the screen and to the printer. If disabled, which is the default, QOut() and QQOut() only write to the screen (and/or to the SET ALTERNATE file). |
_SET_PRINTFILE | <cPrintFileName> , <lAdditive> See also: command SET PRINTER. When set, creates or opens file to write QOut(), QQOut() and DevOut() output to. If <lAdditive> is TRUE and the file already exists, the file is opened and positioned at end of file. Otherwise, the file is created. If a file is already opened, it is closed before the new file is opened or created (even if it is the same file). The default file extension is ".prn". The default file name is "PRN", which maps to the default printer device. Call with an empty string to close the file. |
_SET_SCOREBOARD | <lOnOff> | ON | off See also: command SET SCOREBOARD. When enabled, which is the default, READ and MemoEdit() display status messages on screen row 0. When disabled, READ and MemoEdit() status messages are suppressed. |
_SET_SOFTSEEK | <lOnOff> | on | OFF See also: command SET SOFTSEEK. When enabled, a SEEK that fails will position the record pointer to the first key that is higher than the sought after key or to LastRec() + 1 if there is no higher key. When disabled, which is the default, a SEEK that fails will position the record pointer to LastRec()+1. |
_SET_STRICTREAD | <lOnOff> | on | OFF See also: command SET STRICTREAD. When disabled, which is the default, internal memory buffers are used to load datbase fields into memory variables. When enabled, datbase fields are always read from disk. |
_SET_TIMEFORMAT | <cTimeFormat> See also: command SET TIME. <cTimeFormat> is a character string specifying the Time part of DateTime() values. It is coded as "hh:mm:ss.ccc [pm]". |
_SET_TRACE | <lOnOff> | ON | off See also: command SET TRACE. When enabled, which is the default, output of function TraceLog() is written to the trace file specified with _SET_TRACEFILE. When disabled, function TraceLog() produces no output. |
_SET_TRACEFILE | <cFileName> The setting specifies the trace file name where function TraceLog() writes output to. The default value is "trace.log". |
_SET_TRACESTACK | <nCallStack> The setting defines the first routine in the callstack to add to the trace file with function TraceLog(). The default value is 2. |
_SET_TRIMFILENAME | <lOnOff> When disabled, which is the default, strings containing file names are treated according to SET FILECASE and SET DIRCASE. When enabled, trailing blank spaces in file names are ignored, in addition. |
_SET_TYPEAHEAD | <nKeyboardBufferSize> See also: command SET TYPEAHEAD. Sets the size of the keyboard typeahead buffer. Defaults to 50. The minimum is 16 and the maximum is 4096. |
_SET_UNIQUE | <lOnOff> | on | OFF See also: command SET UNIQUE. When enabled, indexes are not allowed to have duplicate keys. When disabled, indexes are allowed duplicate keys. |
_SET_VIDEOMODE | <nVideoMode> See also: command SET VIDEOMODE. Specifies the video mode. |
_SET_WRAP | <lOnOff> | on | OFF See also: command SET WRAP. When enabled, lightbar menus can be navigated from the last position to the first and from the first position to the last. When disabled, which is the default, there is a hard stop at the first and last positions. |
See also: | SetCancel() |
Category: | Environment functions |
Header: | set.ch |
Source: | rtl\set.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example implements a user defined function that saves/restores all // system settings available in xHarbour. Note the constants _SET_COUNT, // HB_SET_COUNT and HB_SET_BASE. They are used to distinguish Clipper // compatible settings from xHarbour additions. #include "Set.ch" PROCEDURE Main LOCAL aSet := Settings() AEval( aSet, {|x| QOut( ValToPrg(x) ) } ) RETURN FUNCTION Settings( aNewSet ) LOCAL nAll := _SET_COUNT + HB_SET_COUNT LOCAL aOldSet[ nAll ] LOCAL nSetting := 0, i, j DO WHILE ++ nSetting <= _SET_COUNT IF aNewSet == NIL aOldSet[nSetting] := Set( nSetting ) ELSE aOldSet[nSetting] := Set( nSetting, aNewSet[nSetting] ) ENDIF ENDDO j := nSetting FOR i:=1 TO HB_SET_COUNT nSetting := HB_SET_BASE + i - 1 IF aNewSet == NIL aOldSet[j] := Set( nSetting ) ELSE aOldSet[j] := Set( nSetting, aNewSet[j] ) ENDIF j++ NEXT RETURN aOldSet
http://www.xHarbour.com