0 Replies Latest reply: Sep 29, 2009 10:59 AM by Mike.Edel RSS

    (CS3, JavaScript) Adding UI elements at runtime

    Mike.Edel Community Member

      Hi all,

       

      I am trying to add additional UI elements a the runtime of my script when the dialog is visible.

      basicly I'm inside the onClick function of a button and want to add some new elements (listbox depending on the files the user selected) to the main dialog.

      Unfortunately this does not work at all. I can change existing ui elements but not add new ones.

       

      simplified example:

      --------------------

      #target illustrator

      function onSelect (){

           //this.window is the main window

           this.window.add("statictext",undefined,"additional text element");

           return (1);

      }

       

      var mainWindow = new Window("window",undefined,"main Window");

      //add a button

      var selectionButton=mainWindow.add("button",undefined,"selectButton");

       

      //if the user clicks the button...

      selectionButton.onClick=onSelect;

      //show the main window

      mainWindow.show();

      ---------------------

       

      Any indeas what's wrong?

       

      Thanks

       

      Mike

       

      ps: I didn't check the example for runtime errors, just typed it in here...