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

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


Using multiple cards

The sample HDML decks in the UP.SDK Getting Started Guide manual contain only single display cards. It is possible for a single display card to contain a large amount of information. When a card has more lines than the phone can display at once, the user can scroll to see all of the lines. However, when you want to display more than a relatively small amount of information, it is recommended that you divide it into multiple display cards, rather than putting it all on one card. This enables the user to navigate quickly through the information.

Before defining a deck containing multiple display cards, it is helpful to look at a simple synopsis of the <DISPLAY> statement1:

A <DISPLAY> statement can contain zero or more <ACTION> statements, each of which assigns a task to a key. The following is a simplified synopsis of the <ACTION> statement:

For example, the following deck displays a weather forecast on three display cards. The cards are shown in Figure 1-1.

FIGURE  1-1.     Multiple display cards in a deck

When a phone first loads a deck, it automatically displays the first card in the deck. The order in which it displays subsequent cards depends on the navigation scheme specified by the deck's HDML and what the user does.

The deck defined above provides the simple navigation scheme indicated by the arrows in Figure 1-1. When the user presses ACCEPT in the first card, the phone displays the second card. This is specified by the <ACTION> statement in the first card:

This statement instructs the phone to change the label of the ACCEPT key from OK to Tues and to go to a card named tues (the second card in the deck) when the user presses the key. Likewise, the ACTION statement in the second card instructs the phone to change the label of the ACCEPT key from OK to Wed and to go to a card named wed when the user presses the ACCEPT key.

Each phone softkey has a default action associated with it. The default action for the ACCEPT key is to return to the previous card. For example, the third card in the deck above has no <ACTION> statement specifying behavior for the ACCEPT key. So, when the user presses ACCEPT, the phone returns to the previous card. For a complete list of default actions for phone keys, see the HDML Language Reference.



The phone history stack

The UP.Phone maintains a history stack of the cards the user visits. Each time the user navigates forward to a card, the UP.Phone pushes it on to the history stack. When the user presses the PREV key, the UP.Phone pops the current card off the history stack and returns to the previous card.

UP.Phone history operation is similar to that of most Web browsers, except the user can't navigate forward in the UP.Phone history stack; the current card is always at the top of the stack.

For example, suppose the sample deck described above has the following URL:

Figure 1-2 depicts the state of the UP.Phone history stack as the user navigates in the deck described above.

FIGURE  1-2.     Card history

To view the history stack in the UP.Phone simulator, choose History from the simulator Info menu. The simulator prints the stack from bottom to top in the Phone Information window.



Using multiple cards in multiple decks

The example HDML deck above includes three display cards. However, you are not required to put all of your service's cards in a single deck. In fact, because of transmission packet size limitations, you should avoid creating decks larger than 1200 bytes.2

You can rewrite the previous example so that each display card is in a separate deck (and separate HDML file). Assuming you save the decks in files named deck1.hdml, deck2.hdml, and deck3.hdml (in the same directory), you would write the HDML as follows:

Note that the DEST options in deck1.hdml and deck2.hdml specify relative URLs. It is not necessary to specify a full URL, because the decks are in the same directory. It is also not necessary to specify the card name, because the phone automatically displays the first card in the deck.



Defining actions that apply to multiple cards

You can define <ACTION> statements at several levels in HDML. The example in the previous section defines them at the card level. However, you can also define them at the deck level. An <ACTION> statement's scope covers the HDML element in which it is defined: if you define it in a deck's <HDML> statement, it applies to the whole deck; if you define it in a card's <DISPLAY>, <NODISPLAY>, <ENTRY>, or <CHOICE> statement, it applies only to the individual card.

For example, suppose you want to modify the previous example so that the user can press SOFT1 to view information on the moon cycle. To do this, you could add a deck-level action that requests the deck containing the moon information. The changes in the HDML are shown in bold:

FIGURE  1-3.     SOFT1 action defined at deck level


Overriding deck-level actions

When one <ACTION> statement falls within the scope of another, the statement with the narrower scope takes precedence. For example, the following HDML defines a deck-level ACCEPT action and a card-level ACCEPT action.

The ACCEPT action defined at the deck level applies to the entire deck. However, the card-level ACCEPT action defined for card1 overrides it.

FIGURE  1-4.     Card-level action that supersedes deck-level action



Defining links

In addition to specifying actions, which allow the user to user to navigate to different URLs, you can also define links. You can define links in any display text, except in choice cards (discussed below).

Like an HTML link, an HDML link specifies some link text that is distinguished from the surrounding text and a task to execute when the user chooses it. An HDML link can also change the ACCEPT key label and specify an accelerator (or shortcut) key.

When the user scrolls to a link, the phone displays a > marker next to it; the ACCEPT key label changes to the label specified by the link. If the user presses ACCEPT or the accelerator key, the UP.Phone executes the task specified by the link. Typically, the task consists of requesting another URL. However, it may involve other functions, such as dialing a voice phone call.

The following is a simplified synopsis of the <A> statement, which defines a link.

Element  Meaning 

TASK=type  

Specifies the type of task to execute. For example, GO or CALL

DEST=url  

Specifies a URL to request.  

ACCESSKEY=num  

Specifies an accelerator key (0-9). This number appears next to the link. 

LABEL=label  

Specifies the label for the ACCEPT key (optional). When the user scrolls to the link, this label overrides any label specified by actions defined in the current card or deck. 

When one <ACTION> statement falls within the scope of another, the statement with The following HDML defines a card with several links (shown in Figure 1-5).

FIGURE  1-5.     Display card with links

Note that the action defined for the ACCEPT key is valid as long as the user has not positioned the > symbol next to either of the links. When the user scrolls to a link, the label and the task defined by the link take precedence over the action.


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

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


1 The synopses of the <DISPLAY> statement and some other statements in this chapter omit some advanced options. These options are discussed later in this manual.
2 The exact size limit for a deck after the UP.Link compiles it is 1492 bytes. Because compilation can increase the size slightly, it is recommended that you limit deck size to 1200 bytes. To see the actual size of a compiled digest, load the digest in the UP.Phone simulator. The simulator prints the digest size to the Phone Information Window.
Copyright © 1999, Unwired Planet, Inc. All rights reserved.