Saturday, June 17, 2006

 

'Hello World' using Boxely

So...

Lets start and look at some very simple Boxely code, and explain what its all about.
Copy the following code into your blab.box file, and run the AOL Triton shortcut.


<?xml version="1.0" encoding="UTF-8" ?>

<window xmlns="http://www.aol.com/boxely/box.xsd"
        xmlns:s="http://www.aol.com/boxely/style.xsd"
        title="Hello world"
        s:width="180" s:height="80"
/>


And here is the outcome:



analysis:
The first row, which defines the XML version and the document encoding, resides in all AOL Triton box files.
I've tried to delete it and the program still ran. Anyhow it is self explanatory.

The rest of the code is pretty straight forward too.
The box file is used to define the window layout of the program.
Our application has only a single window object.

The window is an object of the class window (under boxely a class or a template is known by the name gadget).

Next we set the window's attributes and style, using an XML like manner.

I don't have a clue what the xmlns and xmlns:s attributes stands for, but they are mandatory in order for the program to run.

Note: If the boxely environment encounters an error while parsing the file (Missing attribute, tag mismatch etc.), the program aborts immediately without any notification.

Setting attributes is done by stating their name, and giving them a proper value, in brackets.
Setting styles is done similarly, using the prefix s: before the style name.

After setting all attributes, we close the window object tag, with a backslash followed by a closing bracket.

Look what happens if you add the following line before the declaration of your window object:

<?import href="box://boxelyToolkit/theme/toolkit.box"?>

The window style suddenly changes a little.
Can you guess why?

I'll try to elaborate on my findings a little bit more on the next post.

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?

Blog Counter