Widget: Plain Text
Introduction
This widget is used to display static plain text within an application. Depending on its location in the application layout, a Plain Text widget is commonly used as:
- Titles and headers preceding another widget.
- Descriptions for elements such as photos and graphical content.
- Labels for specific content in the layout.
This article provides the instructions to add and configure a Plain Text widget.
Adding a Plain Text Widget
To add a Plain Text widget to your Signs application, follow the instructions in the Adding Widgets section in the Managing Widgets article and select the Plain Text widget in the Widget Library.
Configuring a Plain Text Widget
To configure a Plain Text widget’s properties, please follow the instructions below:
In your Signs application’s layout, click the Plain Text widget name under the Widgets section.
In the Widget Properties window, configure the common tabs as per this article: Configuring Widget Properties.
In the Widget Properties window, click the APPEARANCE tab.
In the PROPERTY section, type in the text that you wish to display.
Change the widget font type, size, alignment, and color, in the STYLE section.
When selecting/customizing the font size, you may choose to define a custom size that is measured based on pixels. Select the Custom option from the Size drop-down menu and you will have the option to define the pixel size of your font.
Adding Dynamic Text
In the Widget Properties window, click the APPEARANCE tab.
In the PROPERTY section, select the Dynamic Text checkbox to activate the dynamic text field feature.
Key in the text source and set the refresh interval. You can also set the maximum number of words to be displayed. Add a delimiter if necessary.
Note
Click update to update the editor with your text source. By default, null is displayed.
Click Apply to confirm your settings when finished.
Xpath Expressions in Dynamic Text
This feature enables designers to include customized Xpath (XML Path Language) expressions when creating dynamic queries from XML files via the properties of a text widget. The below is sample code from www.w3schools.com/dom/books.xml.
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="children">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="web">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>
<year>2003</year>
<price>49.99</price>
</book>
<book category="web" cover="paperback">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>
Sample Xpath: /bookstore/book[1]/title
Output: Everyday Italian
Adding Xpath Expressions to Dynamic Text
To add the Xpath Expressions to Dynamic Text in your Plain Text widget, follow the instructions below:
In the Widget Properties window, click the APPEARANCE tab.
In the PROPERTY section, select the Dynamic Text checkbox to activate the dynamic text field feature.
Key in the text source and set the refresh interval. Ensure your text source is an XML file.
Select the PROPERTIES tab, and click the Edit button.
In the same window, click the Add New Property button.
Input the Key and Value, and click OK to save the entry.
Note
In this example, custom.text.dynamic.xmlquery was assigned as the Key, and /bookstore/book[1]/title was assigned as the Value. This expression fetches the title from the first book.
Click Finish to complete the process.
To confirm that the XML query is working, click the APPEARANCE tab. The text in the widget will now be updated (Everyday Italian) as a result of the dynamic text query for the first book title in the code of the XML file.