The Text Object

Text object is based on HTML span element <span>.

var txtSample = new TText('Hello World !!');
var wndTextSample = createWindow('Text Sample');

wndTextSample.add(txtSample);
showModal(wndTextSample);

Text object constructor takes four parameters:

new TText(text, cssClass, parentElementWidth, parentElement);

Tip If you do not specify CSS class name, text object will take 'normalText' class which is definied in VisionicsFramework.css file.

parentElementWidth and parentElement are optional, you may use them when you embed text object inside another HTML element.

Text Methods and Properties
Method/Property Description
addEvent Adds event handler for the specified event on the base span element. Form: addEvent(eventName, eventHandler)
destroy Works as destructor for the text object
disable Disables the text object
enable Enables the text object
getBackgroundColor Gets background color of the text object
getColor Gets color of the text object
getElement Gets the base HTML span element
getHeight Gets the height of the text object
getText Gets text object text
getWidth Gets the width of the text object
getX Gets X coordinate of the text object
getY Gets Y coordinate of the text object
removeEvent Removes event handler for the specified event that is attached to the text object. Form: removeEvent(eventName, eventHandler)
setBackgroundColor Sets background color for the text object. Form:
setBackgroundColor(color)
setColor Sets color for the text object. Form: setColor(color)
setCursor Sets mouse cursor style over the text object. Form: setCursor(style)
setFontFamily Sets font family property of the text object. Form:
setFontFamily(family)
setFontSize Sets font size property of the text object. Form: setFontSize(size)
setInnerHTML Sets inner HTML of the text object. Form: setInnerHTML(html)
setText Sets the text object text. Form: setText(text)
setX Sets X coordinate of the text object. Form: setX(x)
setY Sets Y coordinate of the text object. Form: setY(y)
setWidth Sets width of the text object (in pixels). Form: setWidth(width)