Omnis Technical Note TNPR0006

Horizontal sliding

For Omnis Studio 3.0
By Michael Monschau

Horizontal sliding can be used with text objects in reports. It allows you to place two or more horizontally extending text objects on the same row without the text of one object overwriting the other. If the text of one object is long, it will simply slide the text of the next object out of the way.


How does it work?

For horizontal sliding to work, the text objects must have $horzslide and $horzextend set to true (this includes the first object which does not move, but wants to effect subsequent objects). The $horzextend must be set to true, so the width of the object is altered to fit the text of the object. It is this growing or shrinking of the object which slides subsequent objects. The gap between objects is preserved. If you place two sliding objects 1cm apart, the printed text of both objects will always be 1cm apart.

The text justification is of great importance. It can alter the sliding direction of subsequent or previous objects.

The sliding operation for left justified objects is simple. The object order is from left to right, and objects to the right are moved along, depending on the text width of the objects to the left.

Objects in report ( left, left, left )
Field 1
Field 2
Field 3
 
Resulting Text
111112222233333

The sliding operation for right justified objects is reversed. The object order is from right to left, and objects to the left are moved along, depending on the text width of the objects to the right.


Objects in report ( right, right, right )

Field 1

Field 2

Field 3

 
Resulting Text

111112222233333

When using center justified objects, things become more complex. The center justified object becomes the center of the sliding operation. It does not move. Objects to the right, which are left justified, are evaluated next. Then, objects to the left which are right justified are evaluated in reverse order.

Objects in report ( right, right, center, left, left )

Field 1

Field 2

Field 3

Field 4
Field 5
 
Resulting Text

1111122222333334444455555

A sliding run will break when using a mixture of justification in the wrong order. For example, if a right justified object follows a left or center justified object. One can use this rule to have more then one group of sliding objects on the same row.

Objects in report ( left, left ) ( right, center, left ) (right, right )
Field 1
Field 2
Field 3
Field 4
Field 5
Field 6
Field 7
 
Resulting Text
1111122222
333334444455555
6666677777


Note: Due to a fault which has been fixed in version 3.0 of Omnis Studio, horizontal sliding of center or right justified fields does not work in prior version