1 Reply Latest reply on Sep 6, 2018 7:40 PM by frameexpert

    Refreshing listbox values

    frameexpert Level 4

      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:


      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.

        • 1. Re: Refreshing listbox values
          frameexpert Level 4

          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;