Bambookit Home    Bambookit GUI Tutorial

Back    Next   

IV. Advanced Features

Chapter 16. Real-Time Data Display through Polling

Quick Reference Guide

Method signature

setPoll = "[int] seconds, [String] script"
[int] is an integer value, 0 to 2,147,483,647
[String] is the script to call, returning an XML-GUI file


To retrieve the time at one second intervals
Every second the script getTime.php will be called
This internally will invoke the loadGui method, update set to true.
This means that it will ONLY update widgets, no new widgets are created.
ONLY named widgets are updated

To stop the poll set the poll to '0' or '-1'

Below is the sample application

<?xml version="1.0"?>
<Widget setSize="600,400" setLayout="1,100,25">
<Button setLabel="start poll" addActionTarget="main,action,setPoll='1%2cgetTime.php'"/>
<Button setLabel="stop poll" addActionTarget="main,action,setPoll='0%2cgetTime.php'"/>
<Button setLabel="view source" addActionTarget="main,action,loadUrl='standpoll.xml'"/>
<Widget setName="main" setCache="false" setAnchor="true,true,false,false" setShape="10,40,200,200" setBorder="roundraised"/>

This is the get Time script (written in php)

<Widget setName="poll" setLabel="<?php echo time();?>"/>


The resolution is 1 second increments.
In the script ensure that the first attribute is the setName attribute.

Back    Next