Chapter 5. WML Timers

The previous chapters described how to interact with users in WML. Sometimes, however, you may want something to happen without the user explicitly having to activate a control.

To take a common example, suppose you want to display a company logo when the user connects to your WAP service. On a web page, you’d keep the image for the logo on screen the whole time, but WAP devices have limited screen sizes, and you can’t afford to waste the space.

You could put the image at the top of the first page and let the user scroll down, but cell phone keypads are fiddly, and you’d prefer that the user didn’t have to mess around to see the rest of the service. The same thing rules out a “click to enter” type of control.

What you really want is for the logo to be displayed for a second or two so that the user sees it, and for him to then be transported automatically to the main card. This can be done with a WML timer.

Using Timers with WML

A WML card may have a timer. Whenever the card is entered (whether forwards, as the result of a <go> task, or backwards, as the result of a <prev> task), the timer is initialized with a timeout value and started (unless the timeout is zero, in which case the timer never starts).

Once the timer has started, it counts down either until the count reaches zero or until a task is executed. If a task is executed, the timer is simply stopped beforehand. (Note, however, that a <noop> task doesn’t affect the timer at all.) If the count reaches zero, ...

Get Learning WML, and WMLScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.