Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

How to change the order of pop-up control entries in a custom dialog?

Explorer ,
Sep 01, 2025 Sep 01, 2025

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?

 

Screen3.png

 

    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") {

}
TOPICS
JavaScript , PDF forms
183
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Sep 11, 2025 Sep 11, 2025

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}});
        },
...

@+

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 01, 2025 Sep 01, 2025

Simplest solution is to add "1." and "2.", etc. before the item names.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 01, 2025 Sep 01, 2025

You could capitalize the first letter of the preselected option and use lower case for the rest.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 02, 2025 Sep 02, 2025

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 09, 2025 Sep 09, 2025

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 11, 2025 Sep 11, 2025

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}});
        },
...

@+

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 11, 2025 Sep 11, 2025

Well @bebarth, that's one solution. You marked it as the correct answer right awayWhether 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 11, 2025 Sep 11, 2025

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 11, 2025 Sep 11, 2025
LATEST

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]

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines