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

How to programmatically select a row in a multi-column list box?

Explorer ,
Dec 18, 2017 Dec 18, 2017

Copy link to clipboard

Copied

I know the correct way of getting the selected row is by iterating over dialog.store()[itemId].aRows and finding the row that has the "Select" property set. So I tried programmatically iterating over the rows and setting the "Select" property to true for the row I want to select but it doesn't seem to visually select the row even after calling dialog.load({ itemId: data });

TOPICS
Acrobat SDK and JavaScript , Windows

Views

612

Translate

Translate

Report

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 ,
Dec 18, 2017 Dec 18, 2017

Copy link to clipboard

Copied

Also, the only way I even knew how to interact with a multi-column list_box was by viewing the source of the example dialog PDF at http://adobelivecycledesignercookbookbybr001.blogspot.ca/2013_10_01_archive.html​ . Is this documented anywhere?

Votes

Translate

Translate

Report

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
LEGEND ,
Dec 18, 2017 Dec 18, 2017

Copy link to clipboard

Copied

Unfortunately, not everything that's possible with custom dialogs is documented by Adobe. I'm not aware of a way to select a row programmatically.

Votes

Translate

Translate

Report

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 ,
Dec 18, 2017 Dec 18, 2017

Copy link to clipboard

Copied

You'll find a great deal more info (and more accurate) here:

ACRODIALOGS OVERVIEW

Including a Drag and Drop Dialog Editor. which writes the code for you.

Now, onto the list.

There is no "select" property. list items are selected by setting the item value in the List Item Object to 1.

For example, if there is a list element with an "item_id" of "LST1" then this code sets the "BB" item to selected

dialog.load({LST1:{AA:-1, BB:1, CC:-1});

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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
LEGEND ,
Dec 18, 2017 Dec 18, 2017

Copy link to clipboard

Copied

Thom, do you know how that would work for a multi-column list?

Votes

Translate

Translate

Report

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 ,
Dec 18, 2017 Dec 18, 2017

Copy link to clipboard

Copied

I think I probably jumped on that one too fast.  I'm working on it now.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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 ,
Dec 18, 2017 Dec 18, 2017

Copy link to clipboard

Copied

I was not expecting such an undocumented object when I answered. My mistake. It appears that the author of the blog was probably one of the LC crew in Canada and had inside knowledge of these undocumented dialog features.

I don't know if there is a way to select a row. I tried a few educated guesses, such as setting the Select property as "cschmelter" did. No Luck.  I suspect that Adobe did not include many of the undocumented functions, properties, and elements because they were incomplete. And not having a method to set a default would count as not being complete.

I'm still working on it

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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 ,
Dec 18, 2017 Dec 18, 2017

Copy link to clipboard

Copied

Thanks for looking into this. I didn't want to have to go with an undocumented feature but I didn't see another way of implementing a grid-like display. I might just have to go back to a regular list_box and deal with a single column since I can at least programmatically re-select a previously selected item in the list.

Votes

Translate

Translate

Report

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 ,
Dec 18, 2017 Dec 18, 2017

Copy link to clipboard

Copied

Any idea if there are any plans to fully implement the multi-column list view in the future or any other grid-like object?

Votes

Translate

Translate

Report

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 ,
Dec 18, 2017 Dec 18, 2017

Copy link to clipboard

Copied

Actually, I'm wondering if I can get around the need for re-selecting a row in the grid. Currently I have a dialog where the user does stuff in it, then can dismiss the dialog and bring it up at a later time. Is there any way for the state of the dialog to persist rather than having to re-initialize it every time?

Votes

Translate

Translate

Report

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 ,
Dec 19, 2017 Dec 19, 2017

Copy link to clipboard

Copied

LATEST

As far as Adobe making improvements to general JS SDK. I don't think they've done this since Acrobat 8 or 9.  My impression is that they would rather not improve the ability to automate Acrobat, and slightly regret ever having done it in the first place. The improvements I've seen since Acrobat 7 are so random that I suspect they are the result of requests from big customers.

So if the dialog is not recreated, then it maintains it's static state. So if you create dialog object properties to store the values of all the fields on comment, then those values will be persistent. But they will need to be applied to the fields in the initialize event.

So one solution to your list issue is to have text fields for all the Multi-column values, then fill in the fields when the user selects from the single column list. All the values are there, you just can't see them. You can even punt a bit and make each single entry a list separated by a dash or comma

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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