4D v16.3

System Variables

Home

 
4D v16.3
System Variables

System Variables  


 

 

4D manages system variables, which allow you to control the execution of different operations. All system variables are process variables that can only be accessed within one process. This section describes 4D system variables.

For more information about the type of these variables, refer to System variables in the Typing Guide.

OK  

This is the most commonly used system variable. Usually it is set to 1 when an operation is successfully executed. It is set to 0 when the operation fails. Many 4D commands modify the value of the OK system variable. Refer to the description of each command to find out whether it affects this system variable.

In this documentation, the pictogram indicates that a command modifies the value of the OK variable. You can click on this picture in order to generate a list of all the commands concerned.

FldDelimit contains the character code that will be used as a field separator when importing or exporting text. By default, this value is set to 9, which is the character code for the Tab key. To use a different field separator, assign a new value to FldDelimit.

RecDelimit contains the character code that will be used as a record separator when importing or exporting text. By default, this value is set to 13, which is the character code for the Carriage Return key. To use a different record separator, assign a new value to RecDelimit.

These variables can only be used in an error-catching method installed by the ON ERR CALL command. If you want for them to be accessible in the method that caused the error, copy their value into your own process variables.

  • Error: Longint type system variable. This variable contains the error code. 4D error codes and system error codes are listed in sections of the Error Codes theme.
  • Error method: Text type system variable. This variable contains the full name of the method that triggered the error.
  • Error line: Longint type system variable. This variable contains the line number at the origin of the error in the method that triggered the error.
  • Error formula: Text type system variable. This variable contains the formula of the 4D code (raw text) which is at the origin of the error. The text of the formula is expressed in the current language of the 4D code.  
    If the source code responsible for the error cannot be found, Error formula contains an empty string. This case can occur in compiled databases when:
    • the source code was deleted from the compiled structure using the application builder.
    • the source code is available but the database was compiled without the Range Checking option.

These system variables can only be used in a method installed by the ON EVENT CALL command (except MouseX and MouseY in some cases, see below).

  • MouseDown is set to 1 when the mouse button is pushed. Otherwise, it is set to 0.
  • If the event is a MouseDown (MouseDown=1), the MouseX and MouseY system variables are respectively set to the vertical and horizontal coordinates of the location where the click took place. Both values are expressed in pixels and use the local coordinate system of the window.
  • In case of picture fields or variables, the MouseX and MouseY system variables return the local coordinates of a mouse click in the On Clicked, On Double Clicked and On Mouse Up form events. Local coordinates of the mouse cursor are also returned in the On Mouse Enter and On Mouse Move form events. The coordinates are expressed in pixels with respect to the top left corner of the picture (0,0). For more information, please refer to the Pictures section and the SVG Find element ID by coordinates command.
  • KeyCode is set to the character code of the key that was just pressed. If the key is a function key, KeyCode is set to a special code. Character codes and function key codes are listed in the sections Unicode Codes, EXPORT TEXT and Function Key Codes.
  • Modifiers is set to the keyboard modifier keys (Ctrl/Command, Alt/Option, Shift, Caps Lock). This variable is only significant in an "interruption on event" installed by the command ON EVENT CALL.
  • MouseProc is set to the process number in which the last event took place.



See also 


Sets
Typing Guide
Variables

 
PROPERTIES 

Product: 4D
Theme: Language definition

 
HISTORY 

New
Modified: 4D v15 R4
Modified: 4D v16

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)