DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Integrating applications into the Desktop

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. ``Icon triggers'' shows the default icon triggers.

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_drop
alternate start on file        
On 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.

To define an icon trigger:

  1. Write a Deskshell object script for each trigger you want to define.

    You should only define actions for the triggers listed in ``Icon triggers''. 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.

  2. Name each object script file as specified in Table 2.
When assigning functions to mouse buttons, follow the guidelines defined in the OSF/Motif Style Guide regarding which button does what. Your application will be easier to learn if it uses the mouse buttons in the same ways other applications do.
Next topic: Starting your application with the activate trigger
Previous topic: Create your icon pixmaps

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003