PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Declaring the constants
  • Limits: Declaring a constant member
  • Limits: Declaring constants with the same name
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Constant
In french: Constante
The constants are language elements whose value is fixed once and for all. This value cannot be modified during the execution of the program.
Note: PCS_SANS_TRADUCTION_US. PCS_SANS_TRADUCTION_US
Versions 16 and later
Universal Windows 10 App This feature is now available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This feature is now available for the Windows Phone applications.
Universal Windows 10 App This feature is now available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This feature is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This feature is now available for the iPhone/iPad applications.
iPhone/iPad This feature is now available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This feature is now available in Windows Store apps mode.
Android Widget This feature is now available in Android Widget mode.
New in version 18
Universal Windows 10 App This feature is now available in Windows Store apps mode.
Android Widget This feature is now available in Android Widget mode.
Universal Windows 10 App This feature is now available in Windows Store apps mode.
Android Widget This feature is now available in Android Widget mode.
Versions 20 and later
WEBDEV - Browser code This feature is now available in browser code.
New in version 20
WEBDEV - Browser code This feature is now available in browser code.
WEBDEV - Browser code This feature is now available in browser code.
Versions 21 and later
Universal Windows 10 App This feature is now available in Universal Windows 10 App mode.
Apple Watch This feature is now available in Apple Watch mode.
New in version 21
Universal Windows 10 App This feature is now available in Universal Windows 10 App mode.
Apple Watch This feature is now available in Apple Watch mode.
Universal Windows 10 App This feature is now available in Universal Windows 10 App mode.
Apple Watch This feature is now available in Apple Watch mode.
Example
CONSTANTE
VATRate = 20
END
Syntax

Declaring one or more constants Hide the details

CONSTANT
    <Name of Constant 1> = <Value 1>
    <Name of Constant 2> = <Value 2>
END
<CONSTANT>:
Marks the beginning of the declaration of constants.
<Name of Constant>:
Name of constant to declare.
<Value>:
Value of the constant.
<END>:
Marks the end of the declaration of constants.
Remarks

Declaring the constants

The constants must be declared in:
  • The initialization code of project in order to be used in all the processes of the project (codes of project, codes of windows, codes of controls, procedures, ...).
  • The declaration code of global variables of a window in order to be used in all the processes of the window (code of window, codes of controls found in the window, local procedures, ...).
  • The opening code of a report in order to be used in all the processes of the report (codes of report, code of controls found in the report, local procedures, ...).
  • The declaration code of a class in order to be used in the class.
    • To access this constant from a method of the class, use the syntax "::<Constant name>".
    • To access this constant from a code external to the class, use the following syntax "<Class name>::<Constant name>".
  • Versions 20 and later
    WEBDEV - Browser code The page loading code to be usable in all the browser processes of the page.
    New in version 20
    WEBDEV - Browser code The page loading code to be usable in all the browser processes of the page.
    WEBDEV - Browser code The page loading code to be usable in all the browser processes of the page.
Note: A constant is always global:
  • to a project,
  • to a window,
  • to a page,
  • to a report,
  • to a class.
Versions 20 and later
WEBDEV - Server codeWEBDEV - Browser code Note: A constant declared in server code can be used in browser code.
New in version 20
WEBDEV - Server codeWEBDEV - Browser code Note: A constant declared in server code can be used in browser code.
WEBDEV - Server codeWEBDEV - Browser code Note: A constant declared in server code can be used in browser code.

Limits: Declaring a constant member

A constant member cannot be declared in:
  • a structure,
  • a composite variable.

Limits: Declaring constants with the same name

  • Several elements (variables or constants) with the same name cannot be declared in the same process.
  • If a constant and a variable have the same name in the same project:
    • the variable will be used in the process where it was declared and in all the linked processes.
      For example, the variable is declared in the click code of a button. When a click is performed on this button, this variable is passed in parameter to a local procedure. This variable will be used in this local procedure.
    • the constant will be used in all the other processes.
  • If a constant "global" to the project and a constant "global" to a window have the same name:
    • the constant "global" to the window will be used in all the processes of the window and window controls as well as in the "local" procedures of the window.
    • the constant "global" to the project will be used in all the other processes.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment