2 Replies Latest reply on Feb 26, 2009 4:01 AM by robin521

    Drop down menu help

    Seth McGraw Level 1
      There are 18 colors and a selection for "none" that I want in a drop down menu. The menu is made already, but I have no clue how to set it up.

      Can anyone show me a simple drop down menu in an example? The value (0-19) returned is going to hopefully associate with an array with the 18 color names (although I'm not sure how to do that either).

      Thanks
        • 1. Re: Drop down menu help
          Kasyan Servetsky Level 5
          myDialogResult();
          
          if (myReturn) {
          alert("You selected " + app.activeDocument.swatches[myDropdownResult].name);
          }
          else {
          alert("You canceled dialog.");
          }


          function myDialogResult(){
             with(myDialog = app.dialogs.add({name:"Swatches in the active document"})){
                myDialogColumn = dialogColumns.add(); 
                with(myDialogColumn){
                   with(borderPanels.add()){
                   staticTexts.add({staticLabel:"Swatches "});
                   myArray = app.activeDocument.swatches;
                      myDropdown = dropdowns.add();
                      myDropdown.stringList = myArray.everyItem().name;
                      myDropdown.selectedIndex = 0;
                   }
                }
                myReturn = myDialog.show();
                if (myReturn == true){
                   myDropdownResult = myDropdown.selectedIndex;
                   myDialog.destroy;
                   return myDropdownResult;
                   }
                else {
                myDialog.destroy();
                } 
             }
          }
          • 2. Re: Drop down menu help
            robin521 Level 1

            var MyFontList=new Array;

            MyFontList=app.fonts.everyItem().name;



            var MyDialog=app.dialogs.add({name:"The FontList"});
            with(MyDialog){

            with(dialogColumns.add()){
              with(borderPanels.add()){
              staticTexts.add({staticLabel:"Select Font:"});
              }
            with(dialogColumns.add()){
              var myMenu=dropdowns.add({stringList:MyFontList,selectedIndex:0});
              }
            }
            }

            var myResult=MyDialog.show();
            MyDialog.destroy();