1 Reply Latest reply on Mar 16, 2015 12:59 PM by Loic.Aigon

    Dialog window about question

    hamdifem Level 1

      Hello,

       

      How I can catch enter button pressed on a EditText?

       

      For Example we can do something like

       

      1. window.add("checkbox", undefined, "Example").onClick = function() {

                      // checkbox state changed

      }

       

      But can we catch enter button pressed onEditText like something like this?

       

      1. window.add("edittext", undefined, "Example").onEnterPressed = function() {

                      //

      }

        • 1. Re: Dialog window about question
          Loic.Aigon Adobe Community Professional

          Hi,

           

          You can try this:

           

          var w = new Window('dialog');
          w.preferredSize = [500,500];
          w.alignChildren = ["fill","fill"];
          var et = w.add("edittext", undefined, "Example");
          var st = w.add('statictext',undefined,"" );
          var onKeyDown = function(evt){
            st.text = ( evt.keyName== "Enter" )? "You hit Enter key…" : "";
          }
          et.addEventListener('keydown', onKeyDown );
          
          
          w.show();
          

           

           

          HTH

           

          Loic

          http://www.ozalto.com