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

Refreshing listbox values

Community Expert ,
Sep 06, 2018 Sep 06, 2018

Copy link to clipboard

Copied

Hi, I am using ExtendScript on Windows 7. I have a listbox with data in it. I want to be able to update the listbox with a brand new array of data on the fly when the user clicks the << or >> buttons. Here is what my palette looks like:

palette.png

In my button events, I have:

palette.attrValues.items = values;

where values is the new array of strings. But the palette does not update. Any advice would be appreciated. Thank you very much.

TOPICS
Scripting

Views

910

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

correct answers 1 Correct answer

Community Expert , Sep 06, 2018 Sep 06, 2018

Thanks to Peter Kahrel excellent ScriptUI guide, I found out a good way to do it. I simply create a new list box, add it to the palette and delete the old one. It works great. I am using this function inside my script. It may not make total sense because you can't see the whole script, but you should be able to see where I am making a new list and deleting the old one.

function updateList () {

    var newList;

    palette.currIndex = set.index;

    palette.text = "attribute: " + set.name;

    //

...

Votes

Translate

Translate
Community Expert ,
Sep 06, 2018 Sep 06, 2018

Copy link to clipboard

Copied

LATEST

Thanks to Peter Kahrel excellent ScriptUI guide, I found out a good way to do it. I simply create a new list box, add it to the palette and delete the old one. It works great. I am using this function inside my script. It may not make total sense because you can't see the whole script, but you should be able to see where I am making a new list and deleting the old one.

function updateList () {

    var newList;

    palette.currIndex = set.index;

    palette.text = "attribute: " + set.name;

    // Create a new list for the new values.

    // Use the existing list's bounds so the new list will be the same size/location.

    // set.values contains the new values for the listbox.

    newList = palette.listGroup.add ("listbox", palette.attrValues.bounds, set.values, {multiselect:true});

    newList.alignment = ['fill', 'fill'];

    // Delete the old list.

    palette.listGroup.remove (palette.attrValues);

    // Update the variable so it points to the new list.

    palette.attrValues = newList;

}

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