Runtime Revolution
 
Articles Other News

Introducing Templates in Galaxy 1.5

by Jerry Daniels

 

Using and Creating Stack Templates with Galaxy 1.5

One of the new features of Galaxy 1.5 is the use of templates when creating a new stack. As users have pointed out already, this certainly not the most amazing feature of the new release of Galaxy, but it is probably the most visually dramatic. With that thought in mind, let's talk about templates and show some screen shots.

Galaxy 1.5 comes with four stack templates: a vanilla window, an ask dialog, an answer dialog and a list dialog. These seemed to us the most commonly needed stacks. The vanilla window is just a window that is resizeable. No big deal--although it's very cool how you "draw" your stack before it appears on the screen. The dialogs are, however, ready to do work for you from their conception and are huge time-savers.

A Word about Dialogs

Many developers don't use their own dialogs, but instead rely on the built-in ask and answer dialogs. These templates take all the pain out of creating your own dialogs because they're completely scripted. Before they open, they have all the code to parse XML-like data (tagged data) from the dialogData global property (which you set) and then set button labels and field contents accordingly.

<OK>Apply</OK>
<instructions>Type your first name:</instructions>
<answer>Jerry</answer>

Data is "tagged" with the names of its destination fields and buttons

When the user clicks the "OK" button, it takes data from editable fields, tags it and sets the dialogData to it. In the case of lists, it tags the highlighted line number as well. These dialogs are also resizable and come with a fully functional resizeStack handler.

How to Use a Template

First choose "New Mainstack" (or New Substack) from Revolution's File menu. When you do, if you have the Use Galaxy Draw for Stacks turned on in the General Preferences, you will see the following screen:

When you click on one of those images, you will see the screen below, whereupon you click and drag diagonally to create the desired shape of your stack:

As you drag your depressed mouse (he needs Paxil!), you see an inverted rectangle from the click spot to where your mouse moved along with constantly updating width, height and rectangle metrics:

Once you get the size of rectangle you want, release the mouse button and you'll see the finished product set to the rectangle you just drew:

Making Your Own Templates

But even cooler than this, you can make your own templates. First create a stack that you want to use over and over. Save your template stack in the "galaxy/templates/stacks" folder within the plugins folder. That part is easy, but your template won't show up along with the other templates until you make a ".png" file of it.

To make a ".png" of your template you will need to take a screen capture of your stack, then go into Photoshop (or the like), turn it to grayscale and invert it. Then save the resultant image as a ".png" file in the same folder as the template. Name it the same as the template, except for a ".png" suffix instead of ".rev."

When making a ".png" of a template, size does matter, but inversely so. The smaller you make your templates, the more of them you will see on the screen, but you do want them to be recognizable. I think of them as large icons. When capturing the initial image of the template stack, I set the Rev backdrop to white before I take a "snapshot" of it so I can capture the shadow around the stack--which really looks quite ghostly (Whiter Shade of Pale/Procol Harem alert!) once the image is grayscaled and inverted. The shadow effect is not an issue with Windows XP, but it will be when we get Vista pretty soon here.

The top row of the templates screen is occupied by Galaxy's own templates, but the bottom half is all yours. You can have as many as you can squeeze into a single row. But that will not always be the case. In the upcoming point release of Galaxy, we will be able to acommodate lots of your templates. The bottom half of the templates screen will contain images that are drawn from a list of folders within the "galaxy/templates/stacks" folder that will be listed on the left side of the screen. Choose a folder; see the templates. We will also be distributing templates from vendors and professionals who are using Galaxy.

DO Try This at Home

The Galaxy Free that you can download from the Runtime Revolution RevSelect Galaxy page for free (thus the name!) will do everything we've discussed here today. When you try Galaxy it is full-featured, but after thirty days it reverts to Galaxy Dock, Tools and Script Editor--which we refer to as Galaxy Free. Galaxy Templates are still part of the free package.

Most of the several hundred people who have downloaded Galaxy to try it, don't register with our Galaxy Free support site. Galaxy 1.5 has a Check for Updates feature but it will not work for you unless you register with the Galaxy support site. There are several opportunities to do this when using the Galaxy Installer. This product is constantly evolving and you can get involved in that. You will be made welcome!

©2005 Runtime Revolution Ltd, 15-19 York Place, Edinburgh, Scotland, UK, EH1 3EB.
Questions? Email info@runrev.com for answers.