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

Current chapter: Introduction to HDML
Section 13 out of 67 total sections , Section 7 out of 7 sections in this chapter


Formatting display text

The following sections describe how to use HDML statements and tags to format text that is displayed on the phone.



Adding line breaks

To start a new line in display text, insert a <BR> statement where you want to start the line. Note that simply adding a carriage return or line feed in the HDML has no effect; the HDML compiler treats it as a single space.



Setting text wrapping and horizontal scrolling

There are two ways UP.Phones can handle text lines that exceed the display width:

Wrapping is the default mode for all display text except the text in individual choice entry elements. To change the mode to wrapping, insert a <WRAP> statement in the text at the point where you want to change it. To change the mode to horizontal scrolling, insert a <LINE> statement. Once you set the mode, it affects subsequent lines until you reset it. Each <WRAP> and <LINE> statement starts a new line.

When the phone wraps a line of text, it attempts to wrap between words. To prevent the phone from wrapping between two words, separate the words with an &nbsp; (nonbreaking space) escape sequence instead of a space.

For example, the following deck displays the card in Figure 1-16:

FIGURE  1-16.     Display with horizontally scrolled and wrapped lines



Specifying text alignment and tabs

By default, formatted text is left aligned. To right align a line, precede it with a <RIGHT> statement. To center it, precede it with a <CENTER> statement. <RIGHT> and <CENTER> statements apply only to the current line. Center and right alignment are not allowed in items on choice cards.

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. Using tabs in centered lines has unpredictable results; text columns may run into each other.

For example, the following code defines the display card shown in Figure 1-17:

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



Displaying special characters

HDML reserves the <, >, ", and & characters. To display one of these characters in formatted text, you must specify one of the following escape sequences.

Character  Escape sequence 
<  
&lt;  
>  
&gt;  
"  
&quot;  
&  
&amp;  
$  
&dol;  


IMPORTANT     The semicolon (;) is part of the escape sequence for a special character. If you omit it, the HDML compiler generates an error message.

For example, the following code displays the card in Figure 1-18:

FIGURE  1-18.     Display card containing special characters

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 on this function, see the UP.SDK Tools and APIs Reference.

Note that you use the escape sequences listed above only for text that appears on HDML cards. If you are specifying the URL for a DEST option, you must use URL escaping conventions.


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

Current chapter: Introduction to HDML
Section 13 out of 67 total sections , Section 7 out of 7 sections in this chapter


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