5 Replies Latest reply on May 3, 2013 1:43 PM by Charlotte Grow

    How to transmit the data?

    Charlotte Grow Level 1

      In this script I create a window with an Edittext field and two buttons. The user can write something in Edittext field. How to read these data? I want to use it like a pattern in regular expressions.

      I made an Edittext field a variable. How to transmit the data from it?

       

      function SnpCreateDialog()
      {
      this.windowRef = null;
      }


      SnpCreateDialog.prototype.run = function()
      {
      // Create a window of type palette.
      var win = new Window("palette", "Поиск",[100,100,400,250]);  // bounds = [left, top, right, bottom]
      this.windowRef = win;

      // Add a frame for the contents.
      win.pnl = win.add("panel", [25,15,275,135], "Введите данные для поиска");

      // Add the components, two buttons
          var txt = win.pnl.add("edittext", [15,25,230,45],"");
          //win.pnl.txt = win.pnl.add("edittext", [15,25,230,45],"");
      win.pnl.okBtn = win.pnl.add("button", [15,75,105,95], "OK");
      win.pnl.cancelBtn = win.pnl.add("button", [140, 75, 230, 95], "Cancel");

      // Register event listeners that define the button behavior

      var re = new RegExp(pattern);
         
          win.pnl.okBtn.onClick = function() {
        $.writeln("OK pressed");
        alert(re);
              //win.close();
      };
      win.pnl.cancelBtn.onClick = function() {
        $.writeln("Cancel pressed");
        win.close();
      };

      // Display the window
      win.show();
       
      return true;
         
      //var re = new RegExp (txt);
      //alert(re);
      }

       

      if(typeof(SnpCreateDialog_unitTest) == "undefined") {
          new SnpCreateDialog().run();
      }