Phone API Reference - UI Classes (Widgets) - Text
Desk Phone API features described in this section are deprecated and supported only on the following models: D40, d45, d50, d60, d62, d65, d70
Widget used for drawing text on the screen.
Class Constructor
new Text()
Creates a new Text Object.
var textObj = new Text(x, y, width, height[, label]); //new Text Widget |
Initialization Parameters
Name | Required | Type | Default | Description |
---|---|---|---|---|
x | Yes | integer |
| x coordinate value for top left corner. |
y | Yes | integer |
| y coordinate value for top left corner. |
width | Yes | integer |
| Width in pixels. |
height | Yes | integer |
| Height in pixels. |
label | No | string |
| Text to display |
Class Constants
Title | Description |
---|---|
Text.LINE_HEIGHT
D6X Only Text.LINE_HEIGHT_2 Text.ROW_HEIGHT Text.TITLE_HEIGHT | Recommended number of pixels to use for the height of a line of text. You can put another line at y+Text.LINE_HEIGHT, and it will render correctly. This property is dependent on the model of phone the app is running on. For the D6X models three more height definitions are specified. They are Text.LINE_HEIGHT_2, Text.ROW_HEIGHT, and Text.TITLE_HEIGHT.
Basic Example: var h = Text.LINE_HEIGHT; //retrieve our models line height for use below
new Text(0,0, 100, h); |
This Class inherits methods and properties from the Widget Base Class. See Widget Base Class for more information about setting your Object's x, y, w, and h properties or adding children to it.
Methods
Properties
Name | Description |
---|---|
label | The string to display. Change the string of a Text object without having to re instantiate one. Basic Example: textObj.label = "New Value for Display"; |
labelColor | Color of the text. Can be white or black for D40, D50, and D70, or any of the colors specified in the Base Class color properties for the D6X models. Basic Example: |
labelSize | The font size of the label. The default value differs based on phone model, so it is best to make changes relative to the current size instead of specifying a specific size. For example, if you have some bit of text you want a bit larger in your app then create a Text object and multiple it's current label size by 1.2. Basic Example: |