Define icon triggers
The action of pressing a mouse button while pointing
to an icon is called an icon trigger, because it
triggers an action associated with the icon.
Table 11-2
shows the default icon triggers.
Table 11-2 Icon triggers
---------------------------------------------------------------------------- User Mouse Trigger Object script Used for action button type file name ---------------------------------------------------------------------------- double-click 1 static activate start double-click 2 static alt_activate alternate start ---------------------------------------------------------------------------- hold down 3 hold menu pop-up menu ---------------------------------------------------------------------------- drag and drop 1 drop drop start on file drag and drop 2 drop drop start on file drag and drop <Ctrl> 1 drop alt_drop alternate start on file drag and drop <Ctrl> 2 drop alt_dropOn a three-button mouse, the buttons are referred to as mouse buttons 1, 2 and 3. Mouse buttons 1 (the left button by default) and 3 (the right button by default) can be swapped to accommodate left-handed users. On a two-button mouse, users can simulate button 2 by pressing both buttons simultaneously. For more about how a mouse is used, see Using the Desktop.
You should only define actions for the triggers listed in Table 11-2. Other user manipulations of your icon (single-clicking on it or dragging it to a new location, for example) are handled automatically. Sample object scripts for activate, drop, and menu triggers are presented on the following pages.
The activate trigger must be used to start your application. By default, double-clicking with mouse button 2 (the alt_activate trigger) brings up a a dialog box that prompts the user for command line options to the startup command in your activate script. Similarly, a file icon dragged with mouse button 3 and dropped on your icon (the d3 trigger) brings up a prompt for startup options, then executes your script for the drop trigger.
Use the Deskshell command language to write object scripts. It provides the same basic functions as the Bourne shell, along with additional commands for defining special Desktop actions. Instructions for using Deskshell are in the chapter ``Writing scripts in Deskshell'' in the Graphical Environment Guide.
Only write object scripts for those triggers that are relevant to your application. For example, an application that simply displays a clock does not need to define what happens when a text file is dropped on it. If a trigger is not defined with an object script, a message will notify the user that the action (double-click, hold, or drop) is not defined for that button.
You can use a similar application's trigger files as templates for
yours, by copying them to the desired filenames.
In doing so, you will include default rules for 2-state animation.