In addition to the graphics cursor described above, keys, graphical regions, and textual regions have a text cursor associated with them. (A textual region has only a text cursor.) Just as the graphics cursor identifies the starting point for graphical drawing statements, the text cursor identifies the starting point for textual drawing statements. The presence of both a graphics cursor and a text cursor in keys and graphical regions allows you to intermix graphics and text operations easily in the contents of a single object.
Usually, the graphics cursor and the text cursor are at the same place. Whenever the graphics cursor is moved, the text cursor is moved with it. ESL moves the cursors together because text is often used as a label for graphics. Therefore, when text is drawn it is usually drawn at the position at which the next graphics will be drawn. Drawing text does not move the graphics cursor, so when additional graphics are drawn, these graphics will begin at the correct location.
Sometimes, however, text is not just a label for graphics. Several different pieces of text might be drawn, and each piece of text must start immediately after the previous text. Therefore, a separate text cursor is used to control where the text will be positioned. Consider the following examples of how the text cursor and the graphics cursor interact.
Suppose you specify the following:
key Begin at position 10 10
move to 100 100
text "Hello"
the text string is displayed as follows:
After the string is displayed, the graphics cursor remains positioned at 100 100, but the text cursor is positioned after the "Hello" string.
If the next drawing statement specifies a graphics operation, such as drawing a line, ESL begins at the graphics cursor position. The statements:
key Begin at position 10 10
move to 100 100
text "Hello"
draw to 0 0
cause the following to be displayed:
After these statements have been executed, both the graphics cursor and the text cursor are at coordinate position 0 0.
But the effect is different if you display successive text strings. The statements:
key Begin at position 10 10
move to 100 100
text "Hello"
text " Program User"
cause the following to be displayed:
After these statements have been executed, the graphics cursor is still at position 100 100, but the text cursor is at the position immediately following the " Program User" string.
After execution of a textual drawing statement, the text cursor is positioned at the lower right corner of the last drawn character.