Overview of Item Types

Text Items

A text item displays a string of characters on the screen in one or more lines. There is a single custom "vector" font. Text items are created at a default size of one pixel high. Their size can be changed with the scale command or the -place itemconfigure option.

INDICES

Many of the commands for text take one or more indices as arguments. An index is a string used to indicate a particular place within a text, such as a place to insert characters or one endpoint of a range of characters to delete. Indices have the syntax:

base modifier modifier modifier ...

Where base gives a starting point and the modifiers adjust the index from the starting point (e.g. move forward or backward one character). Every index must contain a base, but the modifiers are optional.

The base for an index must have one of the following forms:

		line.char

Indicates char'th character on line line. Lines are numbered from 0. Notice that this is different than the Tk text widget. Within a line, characters are numbered from 0.

		line.end 

Indicates the last character on line line. Lines are numbered from 0.

		char 

Indicates the char'th character from the beginning of the file (starting at 0).

		@x,y

Indicates the character that covers the pixel whose x and y coordinates within the text's window are x and y.

		end

Indicates the last character in the text.

		mark

Indicates the character just after the mark whose name is mark.

If modifiers follow the base index, each one of them must have one of the forms listed below. Keywords such as chars and wordend may be abbreviated as long as the abbreviation is unambiguous. Modifiers must have one of the following forms:

		+ count chars

Adjust the index forward by count characters, moving to later lines in the text if necessary. If there are fewer than count characters in the text after the current index, then set the index to the last character in the text. Spaces on either side of count are optional.

		- count chars

Adjust the index backward by count characters, moving to earlier lines in the text if necessary. If there are fewer than count characters in the text before the current index, then set the index to the first character in the text. Spaces on either side of count are optional.

		+ count lines

Adjust the index forward by count lines, retaining the same character position within the line. If there are fewer than count lines after the line containing the current index, then set the index to refer to the same character position on the last line of the text. Then, if the line is not long enough to contain a character at the indicated character position, adjust the character position to refer to the last character of the line. Spaces on either side of count are optional.

		- count lines

Adjust the index backward by count lines, retaining the same character position within the line. If there are fewer than count lines before the line containing the current index, then set the index to refer to the same character position on the first line of the text. Then, if the line is not long enough to contain a character at the indicated character position, adjust the character position to refer to the last character of the line. Spaces on either side of count are optional.

		linestart

Adjust the index to refer to the first character on the line.

		lineend

Adjust the index to refer to the last character on the line.

		wordstart

Adjust the index to refer to the first character of the word containing the current index. A word consists of any number of adjacent characters that are letters, digits, or underscores, or a single character that is not one of these.

		wordend

Adjust the index to refer to the character just after the last one of the word containing the current index. If the current index refers to the last character of the text then it is not modified.

If more than one modifier is present then they are applied in left-to-right order. For example, the index "end - 1 chars" refers to the next-to-last character in the text and "insert wordstart - 1 c" refers to the character just before the first one in the word containing the insertion cursor.

MARKS

The second form of annotation in text widgets is a mark. Marks are used for remembering particular places in a text. They have names and they refer to places in the file, but a mark isn't associated with particular characters. Instead, a mark is associated with the gap between two characters. Only a single position may be associated with a mark at any given time. If the characters around a mark are deleted the mark will still remain; it will just have new neighbor characters. In contrast, if the characters containing a tag are deleted then the tag will no longer have an association with characters in the file. Marks may be manipulated with the mark sub-command, and their current locations may be determined by using the mark name as an index in widget commands.

One mark has special significance. The mark insert is associated with the insertion cursor. The mark point is an synonym for insert. This special mark may not be unset.

USAGE

Text items are supported by the Pad++ text command. Text items are created with widget commands of the following form:

pathName create text [option value option value ...]

There may be any number of option-value pairs, each of which sets one of the configuration options for the item. These same option-value pairs may be used in itemconfigure widget commands to change the item's configuration. The following options are supported for text items:

[84] -font fontname

(available only for text item types)


Specifies the font to be used for rendering text for this item. fontname must specify a filename which contains an Adobe Type 1 font, or the string "System" which causes the Pad++ line-font to be used. Defaults to "System".

[85] -pen color

(available ony for handle, line, polygon, portal, rectangle, spline, text and textfile item types)

Color specifies a color to use for drawing the text characters; it may have any of the forms accepted by Tk_GetColor. It may also be "none", in which case the text will be not be drawn. This option defaults to black.

[86] -text string

(available only for text and textfile item types)

String specifies the characters to be displayed in the text item. Newline characters cause line breaks, and tab characters are supported. This option defaults to an empty string.

The text command is described above with the other Pad++ commands under WIDGET COMMANDS.

INDICES
MARKS

July 9, 1996 - 9 JUL 1996

Generated with Harlequin WebMaker

Web Accessibility