Dynamic Positioning

<< Click to Display Table of Contents >>

Navigation:  Programming Techniques > Dynamic Positioning >

Dynamic Positioning

Previous pageReturn to chapter overviewNext page

The central text output functions Write, Print (and also the RTF output functions) and the Picture functions are able to compute their object's height - or height and width - when being inserted into a document.  But how large is the height / width?  How can you position the next object relative to the last inserted?

 

The following constants called V-Flags will help:

Flag

Meaning

VFREE

A flag for indicating that VPE shall compute a coordinate dynamically. For text and images it can be used for the right coordinate (width) as well as the bottom coordinate (height). For text it means that the coordinate shall be computed due to the text-length and font size when a text object is inserted. For images the coordinate will be computed based on the resolution and dimensions found in the image file. For Rich Text (RTF) you may only set the bottom coordinate to VFREE, the right coordinate can not be dynamic.

VLEFT

the left coordinate of the last inserted object on the current page

VRIGHT

the right coordinate of the last inserted object on the current page

VTOP

the top coordinate of the last inserted object on the current page

VBOTTOM

the bottom coordinate of the last inserted object on the current page

Note that VPE keeps track of these coordinates for each page separately.

 

NOTE: In .NET you have to prefix the V-Flags with the class name VpeControl, e.g.:
Report.Print(VpeControl.VLEFT, VpeControl.VBOTTOM, "Hello")
 
As an alternative you can use the instance name of the control followed by an
n-Property, e.g.:
Report.Print(Report.nLeft, Report.nBottom, "Hello")
which is the recommended way.

 

Examples:

Write(1, 1, -6, VFREE, "long text.....")

Inserts a text object without frame at position 1cm, 1cm with a width of 6 cm.
Its height is calculated and depends on the length of the text and the font size used.

 

StorePos()

This will store the coordinates (left, top, right, bottom) of the last inserted object on a dynamic stack. The stack is limited in size only by available memory.

 

Write(VRIGHT, VTOP, -4, VFREE, "another text")

This inserts the next text object at position left = 7cm (the right-coord. of the last inserted object [1 + 6]), top = 1cm (the top-coord. of the last inserted object); with a width of 4cm.
The height is computed (VFREE).

 

RestorePos()

This will now restore the last stored coords from the stack.

 

Write(VLEFT, VBOTTOM, VRIGHT, VFREE, "another text2")

This inserts the next text object at position left = 1cm (the left-coord. of the restored coords), top = ?cm (the bottom-coord. of the restored coords, we use a ‘?’ here, because we do not know the exact value, since VPE did compute it), with a width of 6cm (the right-coord. of the restored coords), the height is calculated.