Username: Password:

Text Plug-in Scripting Reference



Overview

The text plugin implements multi-font edit records with styles, color, tabs, and editing features.

The default script for text allows for containment in a border and editing.

The current text focus is controlled by the default project script handler grabfocus.

Messages: nodemove, nodechange, nodeselect, nodeactive

Nodemove is sent when the position of the text changes.

Nodechange is sent when the text changes.

Nodeselect is sent when the text selection changes.

Nodeactive is sent when the active state of the text changes.

 

Commands and Functions



activeget, activeset

active TF = activeget(node name $)
activeset(node name $, active TF)

Turn on or off the active state of the entire text record.

Inactive text is drawn in gray, and the text is not editable.



alignget, alignset

text align # = alignget(node name $)
alignset(node name $, text align #)

Get or set text alignment, -1 to 1 for left, center, and right.



allstylesget, allstylesset

all styles $ = allstylesget(node name $)
allstylesset(node name $, all styles $)

Get or set all text styles in an array.
See: countstyleruns, indextostylerun



autoscrollget, autoscrollset

text has auto scroll TF = autoscrollget(node name $)
autoscrollset(node name $, has auto scroll TF)

Get or set auto scroll.

If true, the text will automatically scroll to keep the selection visible.



blinkget, blinkset

milisecs time to blink # = blinkget(node name $)
blinkset(node name $, milisecs time to blink #)

Get or set the blinking interval in milliseconds.



boundsget, boundsset

rectangle $ = boundsget(node name $)
boundsset(node name $, rectangle $)

Get or set the boundary rectangle of the object.


click

click(node name $)

Get or set the default font to the currently selected text.

Use click to establish a new default font, style, etc. before text entry.


copy

copy(node name $)

An edit copy operation on the selected text.






countselectruns, countstyleruns, indextoselectrun, indextostylerun, stylerunset

total # = countselectruns(node name $)
total # = countstyleruns(node name $)
stylerun info $ = indextoselectrun(node name $, index #)
stylerun info $ = indextostylerun(node name $, index #)
stylerunset(node name $, stylerun info $)

Countstyleruns counts the number of different style runs in the text.

Indextostylerun returns an XML structure that documents the style run.

The returned structure includes information for startoffset, stopoffset, textref, textcolor, fontsize, fontname, and fontstyle.

Stylerunset will set the text to the given style run structure.

Countselectruns and indextoselectrun return the same information for the current text selection.


cut

cut(node name $)

An edit cut operation on the selected text. This is just a copy and delete.




dataget, dataset, datasize

text data $ = dataget(node name $)
dataset(node name $, text data $)
size # = datasize(node name $)

Get or set the text data. Styles are not preserved or returned.

Datasize returns the number of characters in the record.


delete

delete(node name $)

Delete currently selected text.



enabledget, enabledset

enabled TF = enabledget(node name $)
enabledset(node name $, enabled TF)

Get or set the enabled attribute of the text. If enabled, the text inverts the current selection.
See: selectstartstop, selectstartset, selectstartget, selectstopset, selectstopget



fillcolorget, fillcolorset

fill color $ = fillcolorget(node name $)
fillcolorset(node name $, fill color $)

Get or set the fill color behind the text.



fillget, fillset

fill TF = fillget(node name $)
fillset(node name $, fill TF)

Control if the text is filled or transparent.


findtext

found TF = findtext(node name $, the text $)

If the given text string is in the edit record, select the text and return true.

Otherwise, findtext does not change the current selection and returns false.



fontnameget, fontnameset

font name $ = fontnameget(node name $)
fontnameset(node name $, font name $)

Get or set the font name for the currently selected text.

The currently selected text is controled with selectstartset and selectstopset.

If no text is selected the default font name is set or returned.



fontsizeget, fontsizeset

font size # = fontsizeget(node name $)
fontsizeset(node name $, font size #)

Get or set the font size for the currently selected text.

The currently selected text is controled with selectstartset and selectstopset.

If no text is selected the default font size is set or returned.



fontstyleget, fontstyleset

font style name $ = fontstyleget(node name $)
fontstyleset(node name $, font style name $)

Get or set the font style for the currently selected text.

The currently selected text is controled with selectstartset and selectstopset.

If no text is selected the default font style is set or returned.

Available styles include: plain, outline, undeline, and italic.



fromrightget, fromrightset

from right TF = fromrightget(node name $)
fromrightset(node name $, from right TF)

Get or set the fromright attribute of the text.

The fromright flag can be used to remember if a click was made from the right or left.

This attribute effects the caret position in word wrapped text where the caret is at the very end of the line.
See: index2pointhor, index2pointver





fullget, fullset, infoget, infoset

full $ = fullget(node name $)
fullset(node name $, full $)
info $ = infoget(node name $)
infoset(node name $, info $)

Get or set XML data that describes all the settings for this node.

The fullget and fullset routines have a header element with appropriate namespaces, infoget and infoset are an XML snippet for access as a property. Example:

mynode.info.title = "new title"



gutterget, gutterset

text gutter # = gutterget(node name $)
gutterset(node name $, text gutter #)

Set the gutter, which is a border size for the text.



handlesget, handlesset

handles TF = handlesget(node name $)
handlesset(node name $, handles TF)

Turn on or off dragable handles for reshaping the node.

This routine is used by the system tool palettes for manual positioning.
See: markersget, markersset, partget, partset



hittest, hittestall

hit TF = hittest(node name $, hor #, ver #)
hit TF = hittestall(node name $, hor #, ver #)

Returns true if the point is in the text record.

Hittestall will return true even if the text record is inactive.


index2customindex

new index # = index2customindex(node name $, operation $, text index #)

Given an index into the text, return a new custom index based on the specified operation.

The operation parameter can be left, right, home, start, stop, prev, or next.

Start and stop calculate the index for the start or stop of the current line.

Left and right calculate the index for the beginning of the next word to the left or right.

Home calculates the index for the start of the current line after any tabs.

Prev and next calculate the index for the beginning or end of the current word.


index2line

line # = index2line(node name $, text index #)

Given an index into the text, return the line number the index is on.


index2linedata

line data $ = index2linedata(node name $, text index #)

Given an index into the text, return the line of text data the index is on.


index2lineheight

line height # = index2lineheight(node name $, text index #)

Given an index into the text, return the lineheight of that line.


index2lineselect

index2lineselect(node name $, text index #)

Given an index into the text, select the line of text data the index is on.



index2pointhor, index2pointver

hor # = index2pointhor(node name $, text index #)
ver # = index2pointver(node name $, text index #)

Given an index into the text, return the point horizontal and vertical location.

If the index is on a line break, the fromright setting will determine if index2point returns the end of the previous line or the start of the next line.
See: fromrightget, fromrightset


index2worddata

word data $ = index2worddata(node name $, text index #)

Given an index into the text, return the word or text data the index is on.


index2wordselect

index2wordselect(node name $, text index #)

Given an index into the text, select the word or text data the index is on.

This is an easy way to turn every word into a button.


insert

insert(node name $, text data $)

Insert arbitrary text into an edit record.



leadingget, leadingset

text leading # = leadingget(node name $)
leadingset(node name $, text leading #)

Set the leading of the text object for double spacing, etc.







limitdecimalget, limitdecimalset, limitnumberget, limitnumberset, limitsizeget, limitsizeset

limit decimal # = limitdecimalget(node name $)
limitdecimalset(node name $, limit decimal #)
limit number # = limitnumberget(node name $)
limitnumberset(node name $, limit number #)
limit size # = limitsizeget(node name $)
limitsizeset(node name $, limit size #)

These routines limit the number or types of characters that can appear in the field.

Limitsizeset sets the total number of characters allowed.

Limitnumberset controls how many numbers before a decimal point can be typed in the field.

Limitdecimalset controls how many numbers can be typed after the decimal point.



linecolorget, linecolorset

line color $ = linecolorget(node name $)
linecolorset(node name $, line color $)

Get or set the color of the line around the text.
See: linesizeset



linesizeget, linesizeset

linesize # = linesizeget(node name $)
linesizeset(node name $, linesize #)

Get or set the size of the line around the text.


linestarts

line starts $ = linestarts(node name $)

Returns a comma delimited list of the index numbers for each line of text in the field.
See: index2lineheight, index2line, index2linedata, index2worddata, index2lineselect, index2wordselect, index2customindex



markersget, markersset

markers TF = markersget(node name $)
markersset(node name $, markers TF)

Turn on or off the node outline to show selection.

This routine is used by the system tool palettes to show that a node is selected.
See: handlesset, handlesget, partget, partset





moveghostget, moveghostset, movestopget, movestopset

move ghost # = moveghostget(node name $)
moveghostset(node name $, move ghost #)
move stop TF = movestopget(node name $)
movestopset(node name $, move stop TF)

Get or set the movestop or moveghost attribute of the text.

The movestop flag can be used to remember if the selection start or the selection stop was last moved by the cursor.

The moveghost value can be used to remember the last horizontal offset for moving the cursor with arrow keys.

These variables are used by system software during text editing and should not be used for other purposes.



partget, partset

part # = partget(node name $, hor #, ver #)
partset(node name $, hor #, ver #, part #)

Get or set the points for an individual handle.
See: markersget, markersset, handlesset, handlesget



passwordget, passwordset

password TF = passwordget(node name $)
passwordset(node name $, password TF)

Turn on or off the password property.

If true, all text in the record is obscured by ovals.

Use a monospace font like Courier so that all the ovals have the same size and a neat appearance.


paste

paste(node name $)

Paste text from the clipboard.


point2char

hit char $ = point2char(node name $, hor #, ver #)

Given a point, return the actual character that was clicked on, or empty if the point is not in a character.


point2index

text index # = point2index(node name $, hor #, ver #)

Given a point, return the offset into the text where it is.


reset

reset(node name $)

Reset adjusts the bottom of the text to the full length. Useful for scrolling.



scorecolorget, scorecolorset

score color $ = scorecolorget(node name $)
scorecolorset(node name $, score color $)

Get or set the score color of the text. The score appearance is controlled with the score style.

The score is the dotted line under each line of text.
See: scorestyleset, scorestyleget



scorestyleget, scorestyleset

score style name $ = scorestyleget(node name $)
scorestyleset(node name $, score style name $)

Set the style of the text score. Available styles include: none, light, heavy, dashed, and solid.



selectcolorget, selectcolorset

select color $ = selectcolorget(node name $)
selectcolorset(node name $, select color $)

Get and set the color of the text selection. Use black to invert the text as normal.

Be sure to have some contrast between the selection color and the text color.
See: styleset, styleget



selectdataget, selectdataset

text data $ = selectdataget(node name $)
selectdataset(node name $, text data $)

Get or set the text data in the text selection. Setting the data may change the selections stop value.






selectstartget, selectstartset, selectstartstop, selectstopget, selectstopset

text select start # = selectstartget(node name $)
selectstartset(node name $, text select start #)
selectstartstop(node name $, text select start #, text select stop #)
text select stop # = selectstopget(node name $)
selectstopset(node name $, text select stop #)

Control the starting and stoping point of the text selection.
See: enabledget, enabledset



styleget, styleset

style name $ = styleget(node name $)
styleset(node name $, style name $)

Get or set the style of the text border.

Available styles include: solid, macintosh, windows, classic, modern, crystal, and native.

The native style matches the appearance of the current operating system.

The native styles draw the standard platform specific surround for an edit record.

The solid style uses the linesize and linecolor to draw the border.



tabwidthget, tabwidthset

tabwidth # = tabwidthget(node name $)
tabwidthset(node name $, tabwidth #)

Get or set the pixels width of a tab character.



textcolorget, textcolorset

text color $ = textcolorget(node name $)
textcolorset(node name $, text color $)

Get or set the text color for the currently selected text.

The currently selected text is controled with selectstartset and selectstopset.

If no text is selected the default text color is set or returned.



textrefget, textrefset

text ref # = textrefget(node name $)
textrefset(node name $, text ref #)

Get or set the text ref for the currently selected text.

The currently selected text is controled with selectstartset and selectstopset.

The text ref is a user definable number that can be set to any value.

This can be scripted to provide hypertext links associated with any characters.





titlehorget, titlehorset, titleverget, titleverset

title hor # = titlehorget(node name $)
titlehorset(node name $, title hor #)
title ver # = titleverget(node name $)
titleverset(node name $, title ver #)

Get or set the horizontal and vertical offset of all the text.

The horizontal offset squeezes the text from left and right.

The vertical offset cannot push the text past the leading area.



wordwrapget, wordwrapset

text has word wrap TF = wordwrapget(node name $)
wordwrapset(node name $, has word wrap TF)

Get or set word wrap.