The basic text display element.
This class is used for non-editable text fields (as opposed to
tagname <inputtext>. A text field can be initalized
with text content at compile time.
Note that certain attributes on text objects, such as opacity and rotation, only work on embedded fonts. They do not work on client fonts (also called platform fonts, native fonts, platform fonts, etc). See the Developer's Guide for details.
See Also:canvas.maxtextheight and canvas.maxtextwidth
attributes.
| Attributes | |||||
| Name | Usage | Type (Tag) | Type (JS) | Default | Category |
| embedfonts | Tag & JS | boolean | Boolean | setter | |
|
|
|||||
| label | Tag & JS | string | String | setter | |
|
|
|||||
| maxlength | Tag & JS | number | Number | null | readonly |
| maximum number of characters allowed in this field default: null | |||||
|
|
|||||
| multiline | Tag only | boolean | false | final | |
|
If true, the lines of text are wrapped to fit within the text
width. (The name This attribute defaults to true if width and height are explicitly specified. If you set multiline=true, you probably want to explicitly a width for the text also; if multiline=true and you do not specify a width, the system will pick an arbitrary width (100 pixels at the moment). When multiline=true, the text is automatially re-wrapped whenever
the content is modified by calls to |
|||||
|
|
|||||
| pattern | Tag & JS | string | String | readonly | |
| regexp describing set of characters allowed in this field Restrict the characters that can be entered to a pattern specified by a regular expression. Currently only the expression [ ]* enclosing a set of characters or character ranges, preceded by an optional "^", is supported. examples: [0-9]* , [a-zA-Z0-9]*, [^0-9]* default: null | |||||
|
|
|||||
| resize | Tag & JS | boolean | Boolean | false | readonly |
| text width automatically resizes when text is set. default: false | |||||
|
|
|||||
| selectable | Tag & JS | boolean | Boolean | false | setter |
|
If true, the text is selectable |
|||||
|
|
|||||
| text | Tag & JS | string | String | setter | |
|
|
|||||
class, classroot, cloneManager, datapath, id, ignoreAttribute, ignoreplacement, immediateparent, initstage, name, nodeLevel, onconstruct, oninit, parent, placement, subnodes
aaactive, aadescription, aaname, aasilent, aatabindex, align, bgcolor, clickable, clickregion, clip, cursor, defaultplacement, fgcolor, focusable, focustrap, font, fontsize, fontstyle, frame, framesloadratio, hassetheight, hassetwidth, height, layout, loadratio, mask, onblur, onclick, ondata, ondblclick, onfocus, onkeydown, onkeyup, onmousedown, onmouseout, onmouseover, onmouseup, onselect, opacity, options, pixellock, play, resource, resourceheight, resourcewidth, rotation, selectiontype, showhandcursor, source, stretches, subviews, totalframes, unstretchedheight, unstretchedwidth, valign, visible, width, x, xoffset, y, yoffset
| addText() | ||
| LzText.addText(t) | ||
|
Appends the string to the current text in the textfield. |
||
| Parameters | ||
| Name | Type | Desc |
| t | String | The string to add |
|
|
||
| clearText() | ||
| LzText.clearText() | ||
|
Clears the text field (by setting its text to the empty string) |
||
|
|
| escapeText() | ||
| LzText.escapeText(ts) | ||
|
Returns an escaped version of the string if called with no args. If called with a string argument, returns an escaped version of that string (escaped here means markup-escaped, hot http escaped.) |
||
| Parameters | ||
| Name | Type | Desc |
| ts | String | text string to escape |
|
|
||
| getSelectionPosition() | ||
| LzText.getSelectionPosition() | ||
|
Returns the position of the text cursor within this object. If the text cursor is not inside this object, then the method returns -1. |
||
| Returns | ||
| Type | Desc | |
| Number | The position of the text cursor within this textfield, 0 based. If the text cursor is not in the textfield, this method returns -1. | |
|
|
||
| getSelectionSize() | ||
| LzText.getSelectionSize() | ||
|
Returns the length of the text selection in within this object. If the text cursor is not inside this object, then the method returns -1. |
||
| Returns | ||
| Type | Desc | |
| Number | The length of the text selection within this textfield. If the text cursor is not in the textfield, this method returns -1. | |
|
|
||
| getText() | ||
| LzText.getText() | ||
|
Returns the string represented in the text field |
||
| Returns | ||
| Type | Desc | |
| The string in the text field | ||
|
|
||
| getTextHeight() | ||
| LzText.getTextHeight() | ||
|
Calculates the current height of the text held by the text field. |
||
|
|
| getTextWidth() | ||
| LzText.getTextWidth() | ||
|
Calculates the current width of the text held by the text field. |
||
|
|
| setColor() | ||
| LzText.setColor(c) | ||
|
Sets the color of all the text in the field to the given hex color. |
||
| Parameters | ||
| Name | Type | Desc |
| c | Number | The color for the text -- from 0x0 (black) to 0xFFFFFF (white) |
|
|
||
| setHScroll() | ||
| LzText.setHScroll(s) | ||
| Parameters | ||
| Name | Type | Desc |
| s | None | |
|
|
||
| setMultiline() | ||
| LzText.setMultiline(ml) | ||
|
Sets whether or not the textfield wraps. If false, only a single line of text will appear and extra lines will be trucated if the text is set with multiple lines. |
||
| Parameters | ||
| Name | Type | Desc |
| ml | Boolean | true if the text field should allow multiple lines |
|
|
||
| setResize() | ||
| LzText.setResize(val) | ||
|
setResize set behavior of text field width when new text is added. LzText only (cannot be used with LzInputText). |
||
| Parameters | ||
| Name | Type | Desc |
| val | Boolean | if true, the textfield will recompute it's width after setText() is called |
|
|
||
| setScroll() | ||
| LzText.setScroll(s) | ||
| Parameters | ||
| Name | Type | Desc |
| s | None | |
|
|
||
| setSelectable() | ||
| LzText.setSelectable(isSel) | ||
|
Sets the selectability (with Ibeam cursor) of the text field |
||
| Parameters | ||
| Name | Type | Desc |
| isSel | Boolean | true if the text may be selected by the user |
|
|
||
| setSelection() | ||
| LzText.setSelection(start, end) | ||
|
Positions the text selection within the text field. If this object does not already have the focus, this has the ancillary effect of giving it the focus. |
||
| Parameters | ||
| Name | Type | Desc |
| start | Number | The beginning of the text selection, or the position for the text cursor if no end is given. The index is 0 based. |
| end | Number | The end of the text selection. Optional. If not given, then the text cursor is positioned at the start point, but no text is selected. |
|
|
||
| setText() | ||
| LzText.setText(t) | ||
|
setText sets the text of the field to display |
||
| Parameters | ||
| Name | Type | Desc |
| t | String | the string to which to set the text |
|
|
||
| setXScroll() | ||
| LzText.setXScroll(n) | ||
|
Set the x scroll position of the textfield. |
||
| Parameters | ||
| Name | Type | Desc |
| n | Number | set the left edge of the textfield to offset n pixels vertically (n is always < 0) |
|
|
||
| setYScroll() | ||
| LzText.setYScroll(n) | ||
|
Set the y scroll position of the textfield. |
||
| Parameters | ||
| Name | Type | Desc |
| n | Number | set the top line of the textfield to offset n pixels vertically (n is always < 0) |
|
|
||
animate, applyConstraint, applyData, childOf, completeInstantiation, createChildren, dataBindAttribute, destroy, determinePlacement, getAttribute, getOption, getUID, lookupSourceLocator, searchImmediateSubnodes, searchSubnodes, setAttribute, setDatapath, setID, setName, setOption
addProxyPolicy, addSubview, bringToFront, construct, containsPt, getAttributeRelative, getBounds, getColor, getColorTransform, getContextMenu, getCurrentTime, getDepthList, getHeight, getID3, getMouse, getPan, getTotalTime, getVolume, getWidth, init, measureHeight, measureWidth, play, releaseLayouts, removeProxyPolicy, searchParents, searchSubviews, seek, sendBehind, sendInFrontOf, sendToBack, setAAActive, setAADescription, setAAName, setAASilent, setAATabIndex, setAlign, setAttributeRelative, setBGColor, setClickable, setColor, setColorTransform, setContextMenu, setCursor, setHeight, setLayout, setOpacity, setPan, setPlay, setResource, setResourceNumber, setRotation, setShowHandCursor, setSource, setValign, setVisible, setVolume, setWidth, setX, setY, shouldYieldFocus, stop, stretchResource, unload, updateResourceSize
| Events | |
| Name | Description |
| ontext | None |
onaddsubresource, onaddsubview, onblur, onclick, ondblclick, onerror, onfocus, onframe, onheight, onlastframe, onload, onmousedown, onmousedragin, onmousedragout, onmouseout, onmouseover, onmouseup, onmouseupoutside, onopacity, onplay, onremovesubview, onstop, ontimeout, onwidth, onx, ony
Copyright © 2002-2005 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.