HP OpenVMS Systems Documentation |
Common Desktop Environment: Programmer's Guide 1 Basic Application IntegrationContents of Chapter: Basic application integration is a set of highly recommended tasks you should perform. Basic integration does not involve extensive use of the desktop application programmer's interface (API). Therefore, it does not provide other interaction with the desktop, such as drag and drop, session management, ToolTalk messaging, and programmatic access to the actions and data-typing database. A few of the integration tasks covered in this chapter require source code modification. They are optional, and are discussed here because they are closely related to basic integration tasks. Basic Integration FeaturesBasic application integration provides these features for end users:
Organization of Basic Integration InformationMost of the tasks involved in basic integration are also performed by system administrators who are integrating an existing application into the desktop. Therefore, most basic integration documentation is located in the chapter "Registering an Application" in the CDE Advanced User's and System Administrator's Guide.This chapter guides you to that information and contains additional information specific to application programming. Basic Integration TasksThese are the general tasks involved in basic integration:
Levels of PrintingThe printing functionality available to the user depends on the level of integration you use. There are three levels of print integration:
Complete Print IntegrationTo do complete print integration, your application must:
Desktop Printing Environment VariablesTo have fully integrated printing, your application must use the values of the following four environment variables. The LPDEST variable is particularly important. It provides the ability for the user to choose the print destination by using a particular printer drop zone.
A Fully Integrated Print ActionThe print action is usually defined in a configuration file, app_root/dt/appconfig/types/<language>/name.dt.If your print action starts a program that dereferences the four environment variables indicated in "Desktop Printing Environment Variables." then your data type is fully integrated. The print action must be written to be specific for the application's data type and should accept only a single file. For example, the following print action is specific for a data type named ThisAppData:
If your application handles the ToolTalk Media message set Print request, then your print action could send a variant of it with the following actions.
If any of the four environment variables are not set, the corresponding message argument will be null. When the message argument is null, refer to "Desktop Printing Environment Variables" for the default interpretation. Creating Print Actions for Filtered Data or Data Ready to PrintThe desktop print utility /usr/dt/dtlp provides functionality on top of the lp subsystem. It gathers lp print options and prints the specified file.Your application can use dtlp if either of the following conditions is true:
If the file is ready to print, the Print action runs dtlp in the EXEC_STRING. For example:
If the application provides a conversion filter, the filter must be run before running dtlp. For example:
where filter_name is the name of the print filter.Partial Print IntegrationTo do partial print integration, your application must provide a print action. The extent to which printing is integrated depends on which, if any, of the printing environment variables are handled by the actionProviding the Print Command for Partial IntegrationTo provide partial print integration, your application must provide a print command line of the form:
where options provides a mechanism for dereferencing none, some, or all of the printing environment variables (see "Desktop Printing Environment Variables").The simplest form of this print command line omits options.
This command line lets users print your application's data files using the desktop printer drop zones. However, printing destination is not set by the drop zone. In addition, other print behaviors set by the environment variables are not implemented. For example, the desktop may not be able to direct silent printing or remove temporary files.If your print command line provides additional command-line options that correspond to the desktop printing environment variables, you can provide additional integration. For example, the following command line provides the ability to dereference LPDEST:
where:destination is the destination printer. The next print command line provides options for dereferencing all four variables:
where:
Turning Environment Variables into Command-Line Switches If your action is not capable of dereferencing the four environment variables, but it is capable of taking corresponding command-line options, this subsection explains how to turn the environment variable values into command-line options. For example, this is a simple print action that deferences LPDEST:
However, this print action may create unpredictable behavior if LPDEST isnot set. One way to create a Print action that provides proper behavior when variables are not set is to create a shell script that is used by the Print action. For example, the following action and the script it uses properly handle all four environment variables:
The contents of the envprint script follow:
Nonintegrated PrintingIf your application does not integrate printing with the desktop, users must open your application to properly print data files.Nevertheless, you should provide a print action that runs when users drop your application's data files on a printer drop zone. Otherwise, the desktop may assume that the file contains text data, and the print output will be garbled. The desktop provides a print action for this purpose named NoPrint. The NoPrint action displays a dialog box telling users that the data files cannot be printed using the printer drop zones. The NoPrint action displays the Unable to Print dialog box shown in Figure 1-1. Figure 1-1 Dialog box displayed by the built-in NoPrint action
To use the Unable to Print dialog box, create a print action specific to your data type that maps to the NoPrint action. For example, suppose the data type for your application is:
The following Print action maps to the NoPrint for this data type:
Creating a Registration Package for Your ApplicationThe desktop registration package you create for an application should become part of the application's installation package. The procedures for creating a registration package are also performed by system administrators integrating existing applications into the desktop. These procedures and a detailed example are documented in the chapter "Registering an Application" in the CDE Advanced User's and System Administrator's Guide.
|