blob: 8f6ef4cc3cc221088f0ca4f63deacbb6952eaa25 [file] [log] [blame]
{{header}}
{{include field.fragment}}
{{object 16 0}} <<
{{streamlen}}
>>
stream
// In order to get icons from a document, you have to first add icons
// to the document, and the only way to initially get an icon object,
// it would seem, is from a button in a field. Then it can be added
// any number of times, which does nothing but accumulate the list of
// names of the added icons. Whee.
try {
var doc = this;
app.alert("doc is " + doc);
var icon = doc.getField("MyField.MyPushButton").buttonGetIcon();
app.alert("icon is " + icon);
doc.addIcon("icon1", icon);
doc.addIcon("icon2", icon);
app.alert("icon list is now " + doc.icons);
var icon1 = doc.icons[0];
var icon2 = doc.icons[1];
app.alert("they are named " + icon1.name + " and " + icon2.name);
var icon1_again = doc.getIcon("icon1");
var icon2_again = doc.getIcon("icon2");
app.alert("they are also named " + icon1_again.name +
" and " + icon2_again.name);
app.alert("but they are made anew each time since " +
(icon1 == icon1_again) + " is returned from comparison");
} catch (e) {
app.alert("error: " + e);
}
try {
icon1.name = "chowder";
} catch (e) {
app.alert("As expected, trying to change the name gave: " + e);
}
endstream
endobj
{{xref}}
{{trailer}}
{{startxref}}
%%EOF