Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
10.  Introduction to Actions and Data Types Introduction to Data Types How Data Types Connect Data Files to Actions Running Actions from the Selected Menu  Previous   Contents   Next 
   
 

The TYPE field specifies that this is a map action; the MAP_ACTION field specifies this action runs the Xwud action. The ARG_TYPE field specifies that this action applies only to files whose data type is XWD.

Compare the previous definition of the Open action to the next definition, which appears in the database file /usr/dt/appconfig/types/C/dt.dt.

ACTION Open
 {
 	LABEL					Open
 	ARG_TYPE				BM
 	TYPE					MAP
 	MAP_ACTION			Dticon
 }

This definition applies to files of data type (ARG_TYPE) BM (bitmap files). The definition maps the Open action to the Dticon action, which runs Icon Editor.

Defining the Double-Click Behavior of the Data Type

The data type's double-click behavior is defined by the first entry in the ACTIONS field. For example, for the XWD data type, the double-click behavior is to run the Open action, which in turn runs the Xwud action.

Dropping a Data File on an Action Icon

When the user drops a data file on an action icon, the system runs the action using that data file as the argument for the action (see "How Actions Use Data Files as Arguments").

For example, when an XWD data file is dropped on the Xwd Display icon, the Xwud action is run using the data file argument. This runs the xwud X client with that data file.

Creating Desktop Printing for a Data Type

Desktop printing provides these ways to print a data file:

  • Using the Print command, if available, in the File Manager Selected menu.

  • Dropping a data file on a desktop printer drop zone (the Front Panel Printer control or a printer icon in Print Manager).

In addition to desktop printing, many applications provide a way to print from within the application.

Desktop printing uses actions named Print. Print, like Open, is an action name that is used for many different types of data. Therefore, Print actions use action mapping and the ARG_TYPE field to customize printing for each data type.

For example, here is the Print action for the XWD data type. The definition is located in /usr/dt/appconfig/types/language/xclients.dt:

ACTION Print
 {
 	LABEL					Print
 	ARG_TYPE				XWD
 	TYPE					MAP
 	MAP_ACTION			NoPrint
 }

This Print action, specific to XWD files, is mapped to a NoPrint action. NoPrint is a special action defined in /usr/dt/appconfig/types/language/dt.dt. The NoPrint action displays a dialog box telling the user that this data type cannot be printed.

Compare the XWD Print action with the following Print action for PCL files:

ACTION Print
{
 	LABEL				Print
 	ARG_TYPE			PCL
 	TYPE				MAP
 	MAP_ACTION		PrintRaw
 }

The PrintRaw action, defined in the configuration file /usr/dt/appconfig/types/language/print.dt, contains the command line for printing the PCL files.

ACTION PrintRaw
 {
 	TYPE						COMMAND
 	WINDOW_TYPE				NO_STDIO
 	EXEC_STRING				/usr/dt/bin/dtlp -w %(File)Arg_1%
 }
 
 
 
  Previous   Contents   Next