Constant Customization

The Constant Customization feature allows you to define values for one or more constants in a program prior to performing a conditional compile (Compile | Conditional Compile and Save). The constants can be set up with an edit box, a spin box for selecting/entering a value, or with a list box. A step increase/decrease can be defined for the spin box, as well as maximum and minimum values.

To set up Constant Customization, place the cursor on a blank line within the CRBasic Editor then click the Tools menu and select Set Up Constants Customization Section. This will insert two comments into the program:

'Start of Constants Customization Section

 

'End of Constants Customization Section

Within these two comments, define the constants. Following each constant, use the following keywords (formatted as a comment) to set up edit boxes, spin boxes, or list boxes for the constant values. The fields are edit boxes by default. If a maximum/minimum are defined for a constant, the field will be a spin box. If a discrete list is defined for the constant, the field will be a list box.

The Constant Customization syntax may be best understood by looking at an example. Consider the following program code:

'Start of Constants Customization Section
Const SInterval=10
'Min=5
'Max=60
'Inc=5

Const SUnits = sec
'value=sec
'value=min

Const Reps=1

Const Number=0
'Min=-100
'Max=100

Const TableName="OneSec"
'value="OneMin"
'value="OneHour"
'value="OneDay"

'End of Constants Customization Section

This code will create the following constant customization window:

Before compiling the program, open the Customize Constants window (as shown previously), select the constant values you want to compile into the program, and then perform the Conditional Compile and Save. See also Compile Menu.