Skip to main content
Participating Frequently
May 2, 2013
Answered

How to transmit the data?

  • May 2, 2013
  • 1 reply
  • 633 views

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();
}

This topic has been closed for replies.
Correct answer Willam van Weelden

Use:

win.pnl.txt = win.pnl.add("edittext", [15,25,230,45],"");

And then in the OK BTN function:

var value = this.parent.txt.text;

Greet,

Willam

1 reply

Peter Grainge
Community Expert
Community Expert
May 2, 2013

Charlotte

This isn't the place to ask that question, unless you are very lucky. Most of the folks in this forum are technical authors whose job is to document how software works for end users or to create knowledge bases. Relatively few will use regular expressions in any way and even fewer will write scripts. Some will but very few and even fewer are active supporters of the forum.

I think you will do much better Googling "regex forums" and trying somewhere like http://regexadvice.com/forums/

Good luck with your diploma project.


See www.grainge.org for RoboHelp and Authoring tips

@petergrainge

Use the menu (bottom right) to mark the Best Answer or Highlight particularly useful replies. Found the answer elsewhere? Share it here.
Willam van Weelden
Willam van WeeldenCorrect answer
Inspiring
May 2, 2013

Use:

win.pnl.txt = win.pnl.add("edittext", [15,25,230,45],"");

And then in the OK BTN function:

var value = this.parent.txt.text;

Greet,

Willam

Participating Frequently
May 3, 2013

Sometimes I can read minds.

Greet,

Willam


Thank you very much!