Runtime Revolution
 
Articles Other News

Using Handler Links in GLX2


by Jerry Daniels

 

If you haven't already got this excellent script editor for Revolution, there is still time to get it free with your Revolution purchase until the end of October.

In GLX2--the alternate script editor for Revolution--any call to a handler can appear in a script as a link. This is a tremendously helpful option for Revolution developers in a number of ways. This article will explain the inner workings and intricacies of this mechanism. Cases will be made herein for becoming more productive in creating new works, as well as finding one's way around in older scripts that may have grown "cold."

Links to External (italics) and Internal (non-italics) Handlers shown here in the optional Chalkboard Motif.

Quick Tips on Using the Handler Links Preference

  • Assuming GLX2's optional Handler Links preference is checked in the GLX2 Preferences Palette, all calls to handlers will appear as links in your code.
  • If you really want to see the linked calls easily, check the Bold Links check box.
  • Checking the Update Links on Switch Tab preference will update the links every time you switch tabs.

NOTE: Updating links this assiduously is not always necessary, as links are refreshed naturally each time you compile your scripts.

GLX2 Preference Palette with Handler Link options highlighted

What is Considered a "Call" to a Handler?

A "call" to a handler is any non-quoted reference in script to a handler that might exist in the current script or the script of an object in the current object's path. This does not include a reference to a handler used within the context of the Revolution send command, as in send "wakeUp" to button "alarm". There is a way to go to a handler that is being referenced as part of the send command, and we'll cover that in a moment. For now, know that your handler calls can appear as links, or bold links if the handler you are calling lives within the current script. If you are calling a handler in the object path, it will appear as an italic link or an italic, bold link.

Line 2 of the mouseEnter handler is "calling" the resetStatus handler you see directly below it in this image.

Four Ways You Can Use Handler Links

1. The very presence of links in a handler indicates the handler has "dependencies" upon other handlers. If you are going to copy a handler into a new project, you can now tell at a glance if your handler has any calls to other handlers within it and act accordingly. Big time saver.

2. If you just place your mouse pointer over a link, a tooltip appears containing the parameters of the handler in it.

ASIDE: GLX2 will also auto-complete any handler, so why exactly would I need this feature? Amazingly, I use this feature all the time. It's a Zen thing.

3. If you need to see the code of the handler being called, it's just a click away. (Isn't that a lyric from the Rolling Stones' Gimme Shelter?) Upon clicking a handler link, GLX2 will scroll you to the handler if its in the same script -- or open a new tab if it's in the script of an object in the message path.

4. If you shift-click a handler link, it will show you the handler (and its script) in a split pane view so you can simultaneously see the handler doing the calling AND the handler being called.

Other Linkages

In the Revolution script editor, right-clicking on a Revolution term will take you to its definition in the Revolution documentation. The same is true in GLX2, but right-clicking has another use: linking to a handler that is being sent a message via the send command.

Right-clicking on "mouseUp" will take you to the mouseUp handler in the button and stack indicated literally.

There must be a clear indication of where exactly the message is being sent. Here are the rules:

  1. A 100% literal message and reference to an object in the send command works great.
  2. A literal reference to message and an object reference based on "this card," "me," or the like, will also work.
  3. Messages or references to an object that contains a variable cannot be linked.

Technical Details of GLX2's Creating of Handler Links

If the Handler Links preference is turned on when an object's script is opened in GLX2, the following happens:

  1. All handlers in the object being opened are inventoried into an array containing the html of the handler name with an "<a>" tag.
  2. All handlers in the frontscript, the object's owners, the libraries, and the backscripts are inventoried similarly.
  3. During the colorization process, calls to handlers appear as links, or as italic links if they reference an object outside themselves.

That's a fair amount of processing time devoted to this task. You might ask, "Won't this slow things down?"

The short answer is "Yes, but..."

To understand this cryptic answer you must ask yourself, "Which application opens its documents faster: MS Word or Notepad? Apple's Pages or TextEdit?"

If you have formatting and links in your content, the display takes longer, but the result is worth the effort. At least that is what hundreds of GLX2 users are saying.

What's in the Next Release of GLX2?

New 2.0.2 icons in Status Bar option

Within two weeks of releasing GLX2 version 2.0, a smaller, faster version was released with new features. Two weeks from now, version 2.0.2 -- which is in a beta available to all users -- will be released. It has Quick Prefs, an Uncompiled Scripts palette (aka Ken's Zen), Status Bar and Tab object icons (smaller tabs!) -- and a few power user surprises.

New 2.0.2 icons in tabs option

Starting with version 2.0.2, there will be generous rewards available to users. We are starting a Jedi-themed referral program whereby "Galactic Ambassadors" can cordially and respectfully invite their friends to use GLX2 with a single click, and thereby extend their licenses when that friend signs up for their own GLX2 and the GLX2 Support Site.

If you'd like Jerry to write more articles like this about other parts of GLX2, email us and let us know. And remember, if you want to get this script editor free, you only have until the end of October!

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