[Cover] [Previous Section] [Next Section] [Index]

Current chapter: Introduction to HDML Structure and Syntax
Section 16 out of 35 total sections , Section 10 out of 10 sections in this chapter


Formatted text

HDML allows you to display formatted text in display cards and display content areas of entry and choice cards. It provides a variety of statements to specify how text is wrapped and scrolled, and how it is placed on the phone display.



Reserved characters

The <, >, ", $, and & characters are reserved. To display one of these characters in formatted text, specify one of the following escape sequences.

Character  Escape sequence 

<  

&lt;  

>  

&gt;  

"  

&quot;  

&  

&amp;  

$  

&dol;  

Any ASCII character 

&#nn; (where nn is the ASCII code) 


IMPORTANT     The semicolon (;) is part of the escape sequence for a special character. If you omit it, the UP.Phone will display an invalid deck error.

The UP.SDK provides a Perl utility function named HDMLEscapeString(), which converts the HDML reserved characters in a string to valid escape sequences. For more information, see the UP.SDK Tools and APIs Reference manual.



Line breaking, wrapping, and horizontal scrolling

You can use the following HDML statements to start new lines of formatted text.

Statement  Effect 
<BR>  

Starts a new line. The line uses the default wrapping mode you last specified on the card. 

<LINE>  

Starts a new line. If the text is too large to fit the phone display, the phone automatically scrolls it horizontally so the user can view the entire line. This wrapping mode is known as "Times Square" mode. Until a <WRAP> statement is encountered, all lines that follow the current line are also scrolled. 

<WRAP>  

Starts a new line. If the text is too large to fit the phone display, the phone word wraps the text to the next line. Until a <LINE> statement is encountered, all lines that follow the current line are also word wrapped. 

In <LINE> mode, the phone ignores white space such as multiple spaces, carriage returns, and newlines; these characters do not start new lines. In <WRAP> mode, the phone uses whitespace to conduct word wrapping.

<WRAP> is the default line wrapping mode for formatted text in display, entry, and choice cards. Formatted text in these cards uses the <WRAP> mode until a line starting with a <LINE> statement is encountered. <LINE> is the default wrapping mode for the text in individual choice entry elements.



Vertical scrolling

If a card contains more lines of text than the phone can display, the phone displays as many lines as will fit on the display. Some phones may display visual cues to indicate to the user that there is additional text in the current card. The user can scroll down and see the remaining lines by pressing the down arrow key. After scrolling down, the user can scroll back to the first lines by pressing the up arrow key.



Tabs

To create aligned columns of text, insert <TAB> statements in the text. The phone automatically sets tab stops for you. It treats contiguous lines containing tabs as rows in a table, setting the number of columns to the number of tabs in the line with the most tabs. It sets the width of each column to accommodate the column's largest cell.


IMPORTANT     Using tabs in centered lines has unpredictable results; text columns might run into each other.



Spaces

The HDML compiler converts multiple contiguous spaces, returns, and newlines into a single space. To display multiple contiguous spaces, insert nonbreaking spaces with the &nbsp; element. Each &nbsp; element has the width of a regular space. Note that if you want to allow wrapping in the middle of a series of contiguous nonbreaking spaces, you must insert a regular space where you want to allow wrapping. If you don't want the phone to wrap a line on a particular space, replace the space with a &nbsp; element.


Alignment

By default, formatted text is left aligned. To change the alignment, you can use the following statements at the beginning of a line.

Code  Effect 

<RIGHT>  

Text is right aligned. 

<CENTER>  

Text is centered. 

A <RIGHT> or <CENTER> statement applies to the entire line.


Example

The following HDML deck generates the display shown in Figure 1-12:

FIGURE  1-12.     Display card with formatted text containing tabs

The phone display in this example uses a vertical bar (|) as visual cue to indicate there is additional text to which the user can scroll.


[Cover] [Previous Section] [Next Section] [Index]

Current chapter: Introduction to HDML Structure and Syntax
Section 16 out of 35 total sections , Section 10 out of 10 sections in this chapter


Copyright © 1999, Unwired Planet, Inc. All rights reserved.