English (English)

Global constants

Note.Global constants are used to specify additional search criteria (element's Properties dialog box, Advanced tab, Advanced pre-search relations and Advanced post-search relations sections; block's Properties dialog box, Expression field).

Global constants are set for the entire FlexiLayout and accessible in all sections of the program code.

When creating a global constant, you must specify its name and value. The name of a constant must start with a letter or an underscore character, then it can consist of letters and digits. Constant names must not contain blank spaces or special symbols. The name of a constant must be unique for the FlexiLayout in which it is to be used and cannot coincide with any of the reserved words. This means that you may not declare variables in the code whose names coincide with the names of the global constants.

Constants may be of any type which has a constructor in the FlexiLayout language. The type of a constant is either defined explicitly by calling its constructor, or is derived by the program from its value (e.g. type String). When you use a constant in your code, the compiler will check that this type of constant may be used in the given context. This check is performed when you build the FlexiLayout or when you ask the program to check the code in a particular field.

You can create global constants using global functions and other already created global constants.

Examples of global constants:

Name Value Type
RomanNumerals "I V v X x" String
SomeRect Rect( 5mm, 10mm, 20mm, 50mm ) Rect
FirstPageRect Page( 1 ).RectGlobal Rect
UpperHalfOfFirstPage Rect(FirstPageRect.Left, FirstPageRect.Top FirstPageRect.Right, FirstPageRect.Height / 2 ) Rect
UpperHalfOfFirstPage 1 Region( UpperHalfOfFirstPage ) Region
TotalLineHeightOfFirstPage Page( 1 ).AverageLineHeight() + Page( 1 ).AverageInterlineInterval() Distance
Q_50_Percent Quality( 0.5 ); Quality

Adding, changing, and removing global constants

To add a global constant:

  1. Select the Properties... command from the FlexiLayout menu (or right-click in the FlexiLayout window and select the Properties... command from the shortcut menu).
  2. In the Properties dialog box, click the Constants tab.
  3. Click Add...
  4. Type a name and/or value for the constant and click OK.

To change a global constant:

  1. Select the Properties... command from the FlexiLayout menu (or right-click in the FlexiLayout window and select the Properties... command from the shortcut menu).
  2. In the Properties dialog box, click the Constants tab and select the constant you wish to change.
  3. Click Edit...
  4. Type a new name and/or value for the constant and click OK.

To remove a global constant:

  1. Select the Properties... command from the FlexiLayout menu (or right-click in the FlexiLayout window and select the Properties... command from the shortcut menu).
  2. In the Properties dialog box, click the Constants tab and select the constant you wish to remove.
  3. Click Delete.

Note.A constant name must be a valid identifier, i.e. it must consist of the characters "_ a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" and digits. The first character in the name must not be a digit. Constant names must not contain blank spaces or special symbols.

4/12/2024 6:16:02 PM

Please leave your feedback about this article

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.