4 Replies Latest reply on Sep 23, 2014 1:25 PM by Tete San

    Close() into function using ScriptUI.

    Tete San Level 1

      Guys, I created an interface with ScriptUI that has a iconbutton within a group, which in turn is inside another group. I also created a listener to see which pressed on the keyboard, which performs a function where there is a condition that should close the interface if the key is pressed "Enter." However there is an error on line # 23, I am unable to set the correct path .... I'm even embarrassed to ask, but I'm more than an hour trying and I can not solve this. The onClick event on line # 12 runs correctly kicking the groups using "parent", but how do I need to walk the line as # 23?


      Very Thanks

       

      //
      dialogo();
      function dialogo(){
                  var janela = new Window ("dialog");
                  //     
                              var grupoDaDireita = janela.add ("group");
                              //
                                          var grupo4Dir = grupoDaDireita.add ("group");
                                          //
                                          var btnOK = File (Folder(File($.fileName).parent).fullName+"/"+"ok_btn.png")
                                          var eventoOk = grupo4Dir.add ("iconbutton", undefined, btnOK, {style: "toolbutton"});
                                          eventoOk.onClick = function (){this.parent.parent.parent.close();};
                                          //
                              //
                  //
                  janela.addEventListener ("keydown", function (k) {verificaKeyboard(k);});
                  janela.show ();
      }
      //
      function verificaKeyboard(k){
                  alert(k.keyName);
                  if(k.keyName == "Enter"){
                              janela.close();
                  }
      }
      //