Previous Next
Basic Widgets

Quick start guide

To create a web application that is using the Web Widgets Toolkit, you need to start by importing the following file:

include('widgets.inc.php');
The classes that are using the Web Widgets Toolkit must be defined or included after this line and before the read_and_dispatch function call.

Web Widgets Toolkit needs to use sessions to hold its data and needs to know when to dispatch the user's actions, so you need to add the following code:

read_and_dispatch();
The read_and_dispatch function is the core of the Web Widgets Toolkit functionality, it reads the user's input and dispatch the appropriate actions to the application. The call to this function must be the last line of the main script.

Just like any other application, an entry point for the program is necessary. The entry point for Web Widget Toolkit applications is a function named main:
function main($args)
{
}

Remember that this function must be defined before the read_and_dispatch function call.

Inside the main it is necessary to create a shell to hold the widgets:

$shell =& new Shell();
A shell is the application's container over which the widgets are drawn. There must be only one shell.

Finally you need to open the shell and let the toolkit read and dispatch the user's actions. You can place it after any code you have initializing widgets on the shell.

$shell->open();

The samples folder contains some examples on how to use the Web Widgets Toolkit that allows you to better understand how the source code should be organized. Take a look especially to the events.php file.

Credits

This tutorial was originally written for Eclipse SWT by

Shantha Ramachandran, Christopher Batty, and Weichi Truong
Department of Computer Science
University of Manitoba
Winnipeg, Manitoba, Canada

Previous Next
Basic Widgets

Documentation generated on Wed, 2 Feb 2005 09:33:48 +0100 by phpDocumentor 1.3.0RC3