How Can I Intercept Keystrokes One By One As They Occur; How Can I Build A Nested Popup Menu; How Can I Construct My Own Colors - Adobe 12001196 - Acrobat - Mac Manual

Javascript
Hide thumbs Also See for 12001196 - Acrobat - Mac:
Table of Contents

Advertisement

A Short Acrobat JavaScript FAQ
A

How can I intercept keystrokes one by one as they occur?

Then, when your document (Document A) wants to access the value of interest from the
other form (Document B), it can subscribe to the variable in question:
global.subscribe("xyz_value", ValueUpdate);
In this case, ValueUpdate refers to a user-defined function that gets called automatically
whenever xyz_value changes. If you were using xyz_value in Document A as part of a
field called MyField, you might define the callback function this way:
function ValueUpdate( newValue ) {
How can I intercept keystrokes one by one as they occur?
Create a Custom Keystroke Filter script (see the Format tab in the Properties dialog for any
text field or combo box ) in which you examine the value of event.change. By altering this
value, you can alter the user's input as it takes place.

How can I build a nested popup menu?

Use the app.popUpMenu() method. Create an array of menu selections, then call
app.popUpMenu(arrayName) from the mouse-down or mouse-up event of a given field
to pop the menu. For Acrobat 6.0, you can also use the app.popUpMenuEx() method.
Example:
var cChoice = app.popUpMenu("one", "two", "-",
app.alert("You chose " + cChoice);

How can I construct my own colors?

Colors are Array objects in which the first item in the array is a string describing the color
space ('G' for grayscale, 'RGB' for RGB, 'CMYK' for CMYK) and the following items are numeric
values for the respective components of the color space. Hence:
color.blue = new Array("RGB", 0, 0, 1);
color.cyan = new Array("CMYK", 1, 0, 0, 0);
To make a custom color, just declare an array containing the color-space type and channel
values you want to use.
86
this.getField("MyField").value = newValue;}
[ "three", "three.one", "three.two" ] );
Acrobat JavaScript Scripting Guide

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Acrobat 6.0

Table of Contents