Popup Dialog Hacks for Acrobat Pro: Part I
How to order items in a dialog popup control or dialog list box non-alphabetically. BONUS: How to add section dividers to your popup control and list box lists.
Can you program this dialog list box?
Keep reading to find out how.
Programming Dialog Basics
Undocumented
What does it mean? It means you won’t find it in the official documentation. It doesn’t mean, however, that is doesn’t work. Theoretically it could disappear at any time with a new release of the software. It hasn’t happened so far with any of the undocument tricks I use. I think they are there for the use of the software User Interface (UI) and not meant for general use - but they are accessible through the JavaScript engine. Use them if you want. Or don’t.
edit_text, PopupEdit, SpinEdit, popup, list_box - WTF?
I apologize for the crude acronymn above, but I don’t really know how to express what I’m feeling in a more succinct way (I told my Mom it stands for Why The Face). The documentation provides an example of how to load a list_box element and then states:
“In the example above, if the line type: "list_box" is replaced by type: "popup" and the height specification is removed, the example will run with a pop-up control rather than a list box.”
So far so good. Both work without issue:
//Run this list box in the console:
var dlg={
initialize: function (dialog)
{
dialog.load({"list":
{
"D":-1,
"C":1,
"B":-1,
"A":-1
}
})
},
description:{
elements:
[
{
type: "list_box",
width: 200,
height: 60,
item_id:"list",
},
{
type:"ok_cancel",
}
]
}};
app.execDialog(dlg);
//Run this popup in the console:
var dlg={
initialize: function (dialog)
{
dialog.load({"list":
{
"D":-1,
"C":1,
"B":-1,
"A":-1
}
})
},
description:{
elements:
[
{
type: "popup",
width: 200,
//height: 60,
item_id:"list",
},
{
type:"ok_cancel",
}
]
}};
app.execDialog(dlg);Notice the list is coded in this order: D, C, B, A - but the list displays as A, B, C, D? Keep that in mind as you read through to the solution, the point of this article, which is how to set the list in any order you choose.






