Runtime Revolution
 
Articles Other News

Introducing Galaxy Scripts

by Jerry Daniels

Galaxy Provides Alternatives

Many people have been talking about Galaxy this week. It's available in the Runtime Revolution store, it's part of the RevSelect program, and its release is getting a lot of coverage in technical publications. I've read, interestingly enough, that it is a "replacement" for the Revolution IDE. Trevor DeVore (my collaborator on Galaxy) and I don't think of Galaxy as a replacement. We designed it to offer "alternatives" to the native components in the Revolution IDE (integrated development environment). There's a big difference.

If you were to turn on all components of Galaxy Studio, for instance, you would be using almost a brand new IDE. The dock (Galaxy Bar) at the top of your screen would be different. Although it functions pretty much like the Rev dock, it has some extras and some limitations. With Galaxy Studio would also come a new tool palette (Galaxy Tools), a new script editor (Galaxy Scripts), a whole new approach to property editing (Galaxy Properties), a new message box (Galaxy Message Box), and an alternative dictionary (Galaxy Dictionary). For some of us, that would be a lot of change to accept all at once.

However, all versions of Galaxy let you decide which components you want to use and when you want to use them. For our purposes today, we're going to explore Galaxy Scripts--a  single component of the Galaxy suite. It's a component that is available in Galaxy Free, Galaxy Lite and Galaxy Studio. In particular, we're going to explore Galaxy Scripts' most prominent feature: tabs.

Why Tabs?

Why do Mozilla Firefox, Apple Safari and the new Microsoft Internet Explorer use tabs? It allows the user to organize his/her information into ad-hoc collections. This creation and dissolution of instant collections has obvious benefits for those of us working on handlers that live in many different objects.


Galaxy Scripts show its tabs (reduced size - click to enlarge)

In Galaxy Scripts, when I edit the script of any object, it receives its own "tab." You can see in the screenshot above that we are, indeed, working on the scripts of three different objects represented here by three different tabs. If I click a tab, I will be looking at its script. The disposition of the script is always exactly the way I left it the last time I was editing it--between tab clicks or between sessions of using Revoluiton. The state of the handlers and their folders (that's right, handlers can have folders if you like) is exactly the same.

Operationally speaking, we can work on code that resides in three different objects, and be able to switch between objects by simply clicking on the object's tab--like tabs on file folders in file drawers in offices throughout the world. Users new to Galaxy Scripts sometimes ask: can we have another scripts window? These users are still learning about tabs which offer up to ten script editors in one window. True, you can't see them simultaneously, but then if you want lots of Windows, why not use the Revolution native script editor? You can cover your entire screen with script Windows with it. You see, Galaxy Scripts is an alternative, not a replacement.

With tabs, I can "tab" back and forth between object scripts by clicking tabs or by typing command and the left or right bracket ([]). On Windows this short cut is control + [. These are the same short cuts most web browsers with tabs use, by the way. Tabs let me copy and paste script segements or handlers from object to object without switching Windows. Tabs also tell me about the object's script they house.

Dirty Scripts


Notice that the first tab show here is now has a swatch of yellow color

When I change the content of a script and I have not yet compiled it, the tab of that script will look as if I've taken a yellow magic marker to it, as you see above. Many coders refer to content that has been changed but not saved as "dirty", and so we refer to the scripts these yellow tabs represent "dirty scripts." It can be very helpful to know which tab has unsaved changes in it. Moreover, it's great to know at a glance which object you were just editing. Can you look at ten script Windows on the screen and determine which one has unsaved changes? Perhaps not.

Galaxy Scripts, in addition to having tabs, is also a "stateless" editor. It doesn't care if you compile your scripts or not. It will faithfully preserve the scroll, selection, handler list and dirty state from session to session, provided you save your work, of course. So if you have some dirty scripts and don't want to compile them, but have to shut down Revolution, it's not a problem. Galaxy saves all state information in your objects. This also means that there are developer resources stored in objects, which can be removed with a developer resource stripper that we build into Galaxy, and others offer separately. Revolution's script editor (and others) use a similar approach with developer resources. They are considered needed (or at least acceptable) if they can be removed easily when it comes time to ship a finished product.

I have to take a moment to mention one of Galaxy Scripts coolest features: hyperlinking to handlers, which often opens tabs for you automatically. If you right-click on the name of a handler being used in a statement, Galaxy Scripts will take you to wherever it is that the actual handler resides--in a new tab if the handler's object doesn't already have a tab. It would take a little movie to show you this amazingly helpful feature. This easily cut an hour or two off a day of coding and save some gray hair.

The Tab's Contextual Menu


Galaxy Script's contextual menu for its tabs (click for actual size with 10 point script)

You can close any tab by clicking on it or by typing the escape key while its script is visible, but the tabs also have their own contextual menu. If I right-click on any tab--whether it is the active tab or not--a popup menu appears. This menu will let me close all tabs, the one I just right-clicked, all tabs except the one I right-clicked, or edit the properties of the object represented by this tab. This menu makes tab management much smoother without cluttering the UI landscape with more controls.

If I were to choose "Edit Properties" Galaxy Scripts would instantly become Galaxy Properties and I'd see a tab for the object whose properties I wanted to edit. There are also some no-click short cuts that are Galaxy options and one of them is no-click inspection. On a Mac, holding down the command and option keys will open Galaxy Scripts with a tab representing the object that was directly below your pointer (cursor). This even works for cards and stacks. Hold down the magic keys over a control free area of a card and you'll be editing the card's script in a new tab. Do the same operation over the title bar of a stack and you'll be looking at the stack's script. To inspect an object's properties, you just add the shift key to the magic key mix (shift + command + option on Mac / shift + control + alt on Windows).

Beyond Tabs

Galaxy Scripts is a component with many other features and benefits that will require other articles. I look forward to the journey and welcome fellow explorers.

Lastly, with the idea of Galaxy Scripts' complexity still fresh in my mind and Trevor's, I thought I'd share with you the script analysis of Galaxy Scripts (actual stack name is "revGalaxy code") as produced by the script info tool in Galaxy Projects:

 



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