Copy link to clipboard
Copied
Hi,
I have integrated a pop-up control into a custom dialog. The entries that can be selected in the pop-up control are always listed in alphabetical order. How can I ensure that the preselected option always appears as the top/first entry in the pop-up control and that the other options always appear below the preselected entry?
var layoutDialog = {
cols: "2",
rows: "5",
druck: null,
format: null,
order: null,
direction: null,
initialize: function (dialog) {
dialog.load({
"col1": this.cols,
"row1": this.rows,
"druk": {
"Simplex": +1,
"Duplex": -2
},
});
},
DoDialog: function () {
return app.execDialog(this);
},
description: {
name: "Duplo Finisher: Change Page Order",
elements: [{
type: "view",
align_children: "align_left",
elements: [{
type: "static_text",
name: "Reorder pages for Duplo finisher"
}, {
type: "cluster",
name: "Properties of the printed sheet",
elements: [{
type: "view",
align_children: "align_row",
elements: [{
type: "static_text",
name: "columns:",
char_width: 8
}, {
type: "edit_text",
item_id: "col1",
char_width: 5
}
]
}, {
type: "view",
align_children: "align_row",
elements: [{
type: "static_text",
name: "rows:",
char_width: 8
}, {
type: "edit_text",
item_id: "row1",
char_width: 5
}
]
}, {
type: "view",
align_children: "align_row",
elements: [{
type: "static_text",
name: "print type:",
char_width: 8
}, {
type: "popup",
item_id: "druk",
width: 140,
height: 22
}
]
}
]
}, {
alignment: "align_right",
type: "ok_cancel"
} ]
}
]
}
};
if (layoutDialog.DoDialog() === "ok") {
}
Copy link to clipboard
Copied
Hi,
You could modify a bit your script:
...
initialize: function (dialog) {
dialog.load({
"col1": this.cols,
"row1": this.rows,
});
dialog.load({"druk": {"Simplex": +1}});
dialog.insertSeparatorEntryInList("druk");
dialog.insertEntryInList({"druk": {"Duplex": -2}});
},
...
@+
Copy link to clipboard
Copied
Simplest solution is to add "1." and "2.", etc. before the item names.
Copy link to clipboard
Copied
You could capitalize the first letter of the preselected option and use lower case for the rest.
Copy link to clipboard
Copied
Okay, thanks. Both work. But it doesn't look very nice.
I'll put the hairspace character \u200a in front of it. That looks best visually.
Copy link to clipboard
Copied
I have two solutions for you. One is exactly what you want. They will be published here on Sep 13, 2025:
https://open.substack.com/pub/pdfautomationstation/p/popup-dialog-hacks-for-acrobat-pro
Copy link to clipboard
Copied
Hi,
You could modify a bit your script:
...
initialize: function (dialog) {
dialog.load({
"col1": this.cols,
"row1": this.rows,
});
dialog.load({"druk": {"Simplex": +1}});
dialog.insertSeparatorEntryInList("druk");
dialog.insertEntryInList({"druk": {"Duplex": -2}});
},
...
@+
Copy link to clipboard
Copied
Well @bebarth, that's one solution. You marked it as the correct answer right away. Whether it's the right one remains to be seen.
@PDF Automation Station: I'm excited to see what you'll present.
Since I only ever have two entries in my popup controls, I use the Unicode character u+2063, the invisible separator. I place it before the entry that should not appear first in the popup control.
During my research, I came across this very old post where a user asks for a solution on how to display the names of the months in the correct order in a pop-up control.
Loading items in a dialog edit_text popUpEdit drop down list
With the preceding Unicode character u+2063 (invisible separator), the list looks quite good in the popup control. I don't yet know whether this will be a hindrance to further use after selecting an entry.
dialog.load({"mth1":
{
"Jan":+1,
"\u2063Feb":-2,
"\u2063\u2063Mar":-3,
"\u2063\u2063\u2063Apr":-4,
"\u2063\u2063\u2063\u2063May":-5,
"\u2063\u2063\u2063\u2063\u2063Jun":-6,
"\u2063\u2063\u2063\u2063\u2063\u2063Jul":-7,
"\u2063\u2063\u2063\u2063\u2063\u2063\u2063Aug":-8,
"\u2063\u2063\u2063\u2063\u2063\u2063\u2063\u2063Sep":-9,
"\u2063\u2063\u2063\u2063\u2063\u2063\u2063\u2063\u2063Oct":-10,
"\u2063\u2063\u2063\u2063\u2063\u2063\u2063\u2063\u2063\u2063Nov":-11,
"\u2063\u2063\u2063\u2063\u2063\u2063\u2063\u2063\u2063\u2063\u2063Dec":-12
}
});
Regards
yosimo
Copy link to clipboard
Copied
One of my solutions is the same as @bebarth 's. dialog.insertSeparatorEntryInList( ) and dialog.insertEntryInList( ) are undocumented, but they work. The other solution is to trigger the app.popUpMenu or app.popUpMenuEx method from a button and push the result into a readonly text field. With these methods you can also set the order you want and you can use submenus as well. Sorry to make you wait but the article was already queued up.
Copy link to clipboard
Copied
I didn't know there was an invisible seperator. That's genius. It works. To get the month from the selection, simply split the result by the separator and pull the last element from the array:
var aray=rslt.split("\u2063")
aray[aray.length-1]
Find more inspiration, events, and resources on the new Adobe Community
Explore Now