Handlers

It's about Scripting

handlers1

In GLX2, handlers are distilled from scripts. This process occurs whenever a script it compiled.

Handlers are not created by clicking an "add handler" button or by choosing "new handler" from a menu. In other words, as you script and compile, your handlers are created in a list on the left.

The same can be said for groups of handlers that are part of a "folder." As you type a comment outside of a handler that is preceded by "--> ", you create a folder. There is no other way to create a folder.

By extension, handlers and folders are modified and deleted by actions taken in the script field and nowhere else.


Where's My Handler?

Where_s_My_Handler_

If you have 75 handlers and 15 folders, you may not remember which folder houses your handler--especially if many folders are closed.

The Handlers menu contains an alphabetical list of all handlers. Choosing a handler from this menu will take you to the handler in your script and open its folder in the handler list.


Handler List

handlers3

The list itself works much as you'd expect
• Click a handler or folder name and be taken to it in the script. 
• Click a folder icon to open or close a folderwithout going to the folder in the script. 
• Double click a folder name and open or close the folder.

There are a couple of tricks, though
• Option+click any opened folder icon to close all folders. 
• Option+click any closed folder icon to open all folders.

This one is worth learning for large handlers
• Option+click any handler name to go to the end of the handler.

Unlike some file lists, you cannot click on the text of a handler or folder name in order to edit it. To change handler or folder names (or to create or delete them) you must edit the script because we are, after all, scripters.


Comment Handlers

handers2

How to Create One
• Make a block comment outside of a handler. 
• Block comment = text preceded by /* and followed by */
• The line starting with /* contains the name of the comment handler. 
• If you want more than one word in the handler name, put
* after the last word of the
comment handler name.

Important
• There must be a space between /* and the name of the comment handler. 
• Obvously, you must have text following the /* on the same line.

How They Look
• Comment handlers in the Handler List all have * after them, even when you don't use * in the script from which they are extracted. 
• In scripts, the block comment prefix and suffix are colorized (colourised) the same as "on" or "function" are in any other handler.

How They Work
• In List: Click a Handler Comment in the Handler List and the first line of the Comment Handler in the script is selected. 
• In Script: Click within a Comment Handler in script and the Comment Handler will be selected in the Handler List. 
• Typing: Type the first line of a Comment Handler in script and hit return to see its name appear in the handler list. 
• Auto-complete: Type command+k after the first line of a Handler Comment in script and it is completed. 
• They work like any other handler!


Handler Icons

handler_icons

There are four types of handlers that are indicated with three types of icon. 

1. A public handler (whether command or function) has a paper scroll icon.
2. A private handler (whether command or function) has a lock icon.
3. A property handler (whether setProp or getProp) has a check list icon.
4. A block comment has a note icon.

NOTE: Public Function, private function and getProp handlers have all have parens "()" following their listing in the handler list.

Handler List Viewing

top_prefs

Not everyone likes to sort their folders and handlers alphabetically in the handler list. They'd rather see them in the order they occur in the script.

There are View Prefs in the Preferences Palette* to accomodate all tastes, including sorting and even showing the handler list. Some folks with smaller screens appreciate being able to hide the handler list.


* Preferences Palette

To access the Preferences Palette
• Type command+comma 
• Choose menu item "Preferences" 

Documentation on Preferences is here.

GLX2 Developed by Daniels & Mara  •  GLX2 Prices & Ordering