7.67.52015-05-06

Learning PlanetPress Talk

One of the most efficient ways to familiarize yourself with PlanetPress Talk is to create an object, convert it to PlanetPress Talk, and examine the code, consulting the PlanetPress Talk Language Reference as necessary for explanations of each line of code. You can further verify your understanding by modifying the code and observing the changes that occur in the object as a result.

As an example of this technique, the following is the code for a converted data selection object. The data selection is from columns 1 through 12 on line 1 of the data page.


moveto(0,0)
setstyle(&Default)
margin(0,0.167)
rmoveto(stringwidth(''),0)
rmoveto(neg(stringwidth('')),0)
show(@(1,1,12))

Consider what each line of the code accomplishes, and notice that parameters to a function or procedure may themselves be PlanetPress Talk expressions.

Command:

Tells the document to:

moveto(0,0)

Move the drawing pen to the top left of the object.

setstyle(&Default)

Set the style for the data selection to the default style

margin(0,0.167)

Set the offset for the text, relative to the top left of the object.

rmoveto(stringwidth(' '),0)

 

Move the pen forward the width of the data selection. Here, the purpose of this line is to set a bounding box that appears around the data selection object in the document design window. The bounding box does not print but is a visual cue that keeps the object visible even when its contents are empty.

rmoveto(neg(stringwidth(' ')),0)

Move the pen backward the width of the data selection. This resets the pen to its position prior to executing the previous command. It ensures the previous command does not alter the position of the data selection.

show(@(1,1,12))

Display the text that appears from columns 1 through 12 on line 1 of the current data page.

At this point you might want to introduce other commands into the code, or modify some commands and verify the changes produce the result you expect. Or perhaps you want to create a new data selection that starts in the middle of the data page and extends over several lines to see how PlanetPress Talk handles multi-line data selections.