Using Alternative Dividers

<< Click to Display Table of Contents >>

Navigation:  Programming Techniques > FormFields >

Using Alternative Dividers

Previous pageReturn to chapter overviewNext page

VPE can handle two types of dividers within one and the same FormField - each type having its own height, color and thickness: Dividers and Alternative Dividers

In the following code sample we will display the date May 12th in the notation DD/MM:

VPE.OpenDoc

VPE.CharCount = 4

VPE.AltDividerNPosition = 2

VPE.FormField(1, 1, -2, VFREE, "1205")

VPE.Preview

formfield 0005

The code VPE.AltDividerNPosition = 2 did instruct VPE to treat every second divider as Alternative Divider. By default, AltDividerNPosition is zero (no Alternative Dividers are drawn) and Alternative Dividers are drawn at full height (AltDividerStyle = VFF_STYLE_1_1) with the default PenSize of 0.3 mm.

To add the four digit year value "2003" to the above sample, add another FormField to the right of the previous one:

VPE.OpenDoc

VPE.CharCount = 4

VPE.AltDividerNPosition = 2

VPE.FormField(1, 1, -2, VFREE, "1205")

VPE.AltDividerNPosition = 0        // turn alternative dividers off

VPE.FormField(VRIGHT, VTOP, -2, VFREE, "2003")

VPE.Preview

formfield 0006

 

You might have noticed that the first and last dividers are not treated as normal dividers. In fact they belong by default to the Alternative Dividers.

The behavior of the first and last divider as well as other settings are controlled by the property FormFieldFlags. Possible values of FormFieldFlags are a combination of:

FormFieldFlags

Value

Comment

VFF_FLAG_DIV_FIRST

1

first divider is painted (only, if no frame)

VFF_FLAG_DIV_LAST

2

last divider is painted (only, if no frame)

VFF_FLAG_ALT_FIRST

4

(default) first divider is painted as AltDivider (overrides _DIV_FIRST) (only, if no frame)

VFF_FLAG_ALT_LAST

8

(default) last divider is painted as AltDivider (overrides _DIV_LAST) (only, if no frame)

VFF_FLAG_AUTO_FONTSIZE

16

(default) font size is computed automatically

 

The default value of FormFieldFlags is:

FormFieldFlags = VFF_FLAG_ALT_FIRST + VFF_FLAG_ALT_LAST + VFF_FLAG_AUTO_FONTSIZE

 

For example, if you don't want the first divider to be painted:

VPE.OpenDoc

VPE.CharCount = 4

VPE.AltDividerNPosition = 2

VPE.FormFieldFlags = VFF_FLAG_ALT_LAST + VFF_FLAG_AUTO_FONTSIZE

VPE.FormField(1, 1, -2, VFREE, "1205")

VPE.Preview

formfield 0007

If you want the first and last divider to be painted in the style of the normal dividers:

VPE.OpenDoc

VPE.CharCount = 4

VPE.AltDividerNPosition = 2

VPE.FormFieldFlags = VFF_FLAG_DIV_FIRST + VFF_FLAG_DIV_LAST +

                    VFF_FLAG_AUTO_FONTSIZE

VPE.FormField(1, 1, -2, VFREE, "1205")

VPE.Preview

formfield 0008

 

NOTE: The first and last divider is not drawn, if the FormField has a frame.