0 Replies Latest reply on Feb 6, 2015 11:21 AM by creativejoan0425

    UI dialog error ( Cannot handle request because a modal dialog or alert is active)

    creativejoan0425 Level 1

      I have a dialog which only can run when u select cell, after showing the dialog, I click check1 it will popup another dialog and close the previous dialog, but when I press "enter", I will alert "Cannot handle request because a modal dialog or alert is active", and cannot run the dialog 2 action


      // start myGet Columns Info ---------------------------------------------         

          //now col width

          var mySelColWid = app.selection[0].cells[0].width;

      // end of myGet Columns Info --------------------------------------------- 

      myDisplayDialog2_new();

      function myDisplayDialog2_new(){

       

      //w1 ----------

          var w = new Window("dialog", "Adjust Col._v1.0");

                w.alignChildren = "left";

          var g = w.add ("group");

          var check1 = g.add ("checkbox", undefined, "Figure Col.?");

                 check1.value = true;

          var g2 = w.add ("group");

          var panel = g2.add("panel");

                 panel.orientation = "column";

          var my1row = panel.add("group");

                my1row.orientation = "row";

                my1row.alignment = "left";

                my1row.add ("statictext", undefined, "Col. Width:");

                var myText = my1row.add ("edittext", undefined, mySelColWid);

                      myText.characters = 7;

                      myText.active = true;

          var my5row = panel.add("group");

                my5row.orientation = "row";

                my5row.alignment = "left";

                my5row.add ("button", undefined, "Ok", {name: "ok"});

                my5row.add ("button", undefined, "Cancel", {name: "cancel"});

      //w1 ----------

      check1.addEventListener ("click", function ()

      {

          w.close();

          myDisplayDialog3_new();

          }

      );

      var myWindow1 = w.show();

           if( myWindow1 ==true){

                  app.selection[0].cells.everyItem().width = 100;

          }

      }

      function myDisplayDialog3_new(){

      //w2 ----------

      var w2 = new Window("dialog", "Adjust Col._v1.0");

              w2.alignChildren = "left";

         

      var gA = w2.add ("group");

      var check1a = gA.add ("checkbox", undefined, "Text Col.?");

             check1a.value = false;

      var gB = w2.add ("group");

      var panelA = gB.add("panel");

             panelA.orientation = "column";

      var my1row = panelA.add("group");

            my1row.orientation = "row";

            my1row.alignment = "left";

            my1row.add ("statictext", undefined, "Test Width:");

            var myText_w2 = my1row.add ("edittext", undefined, mySelColWid);

                  myText_w2.characters = 7;

                  myText_w2.active = true;

      var my7row = panelA.add("group");

            my7row.orientation = "row";

            my7row.alignment = "left";

               my7row.add ("button", undefined, "Ok", {name: "yo"});

              my7row.add ("button", undefined, "Cancel", {name: "no"});

      //w2 ----------

      check1a.addEventListener ("click", function ()

      {

          w2.close();

          myDisplayDialog2_new();

          }

      );

          var myWindow2 = w2.show();

          if (myWindow2 == true){

              try{app.selection[0].cells.everyItem().width = 50;

                  }

              catch(e){alert(e);}

          }

      }