5 Replies Latest reply on Oct 12, 2015 12:37 AM by BEGINNER_X

    User Interface (alert but UI Not Hidden)

    BEGINNER_X Level 3

      Hi All,

       

      My Request:

      Paginator need to select the "VERSION" by using User Interface.

      Suppose the Paginator, not select any Drop down menus.

       

      In that time alert will shown like "PLEASE SELECT THE VERSION". But the User Interface not hidden.

       

      But for my code the UI will hide.

      var w = new Window ("dialog");  
      var versions = ["--", "V1", "V2", "V3", "V4", "V5"];
      var myGroup2 = w.add('panel', undefined, "");  
      myGroup2.alignChildren = "left";
      var main = myGroup2.add ("group");
      main.add ("statictext", undefined, "Indesign Versions : ");
      var group = main.add ("group {alignChildren: 'left', orientation: 'stack'}");
      var list1 = group.add ("dropdownlist", [0,0,350,20], versions);
      list1.minimumSize.width = 250;
      list1.selection = 0;
      w.show()
      
      if(list1.selection == 0)
      {
          alert("PLEASE THE VERSION");
          exit(0)   //Need UI NOT TO HIDDEN
      }
      

      Screen Shot 2015-10-09 at 07.24.18.png

       

      Screen Shot 2015-10-09 at 07.24.11.png

       

      Thank in Advance

      SIRAJ

        • 1. Re: User Interface (alert but UI Not Hidden)
          tpk1982 Level 4

          I hope  the below code is u missed

           

          UserInteractionLevels.INTERACT_WITH_ALL

           

          app.scriptPreferences.userInteractionLevel=UserInteractionLevels.INTERACT_WITH_ALL;

           

          karthik

          • 2. Re: User Interface (alert but UI Not Hidden)
            Peter Kahrel Adobe Community Professional & MVP

            If you want to keep the UI on the screen you'll have to define the window as a palette, not dialog. And add the check in a callback that monitors the state of the dropdown and shows the alert whenever the list's selection changes. More or less like this (there was quite a bit of unnecessary stuff there which I left out):

             

            #targetengine Beginner_X;
            
            var w = new Window ("palette");
            var myGroup2 = w.add('panel {orientation: "row"}');
            myGroup2.add ("statictext", undefined, "Indesign Versions : ");
            var list1 = myGroup2.add ("dropdownlist", undefined, ["--", "V1", "V2", "V3", "V4", "V5"]);
            list1.minimumSize.width = 250;
            list1.selection = 1;
            
            list1.onChange = function ()
            {
              if(list1.selection == 0)
              {
                alert("PLEASE SELECT A VERSION");
              }
            }
            
            w.show();
            

            Peter

            • 3. Re: User Interface (alert but UI Not Hidden)
              BEGINNER_X Level 3

              Hi Pkahrel,

               

              Thank you for your support and quick response....

              I think, little bit confused yours....

               

              Default the UI should be "--" only.

               

              After the UI displays, the composer should change into some other versions like V1, V2 etc....

               

              Suppose they forget or ignore then the alert will shown like as below.

               

              But in the below coding, alert shown but the UI should hide (My request is alert but no need to UI hidden)

               

               

              Finally, they select the proper options, UI datas will write in the .xls file.

               

              Sample Coding is below:

              1. if(list1.selection.index == 0
              2.     alert("PLEASE THE VERSION"); 
              3.     exit(0)   //Need UI NOT TO HIDDEN 
              • 4. Re: User Interface (alert but UI Not Hidden)
                Peter Kahrel Adobe Community Professional & MVP

                Ok. Maybe like this:

                 

                var w = new Window ("dialog"); 
                var myGroup2 = w.add('panel {orientation: "row"}'); 
                myGroup2.add ("statictext", undefined, "Indesign Versions : "); 
                var list1 = myGroup2.add ("dropdownlist", undefined, ["--", "V1", "V2", "V3", "V4", "V5"]); 
                list1.minimumSize.width = 250; 
                list1.selection = 0; 
                
                var okButton = w.add('button {text: "OK"}')
                
                b.onClick = function () {
                  if(list1.selection == 0) {
                    alert("PLEASE SELECT A VERSION");
                  } else {
                    w.close();
                  }
                }
                
                w.show();
                

                 

                You want to check the dialog state when the user clicks OK, so you should intercept the OK button's standard function (closing the dialog).

                • 5. Re: User Interface (alert but UI Not Hidden)
                  BEGINNER_X Level 3

                  Thanks a lot PKahrel...

                   

                  Thank you for your wonderful support....