Copy link to clipboard
Copied
How to pass a variable in EditText?
Variable nw in edit0.
Displays: "NaN".
function dialog(nw) {
var dlg=
"dialog{text:'Script Interface',bounds:[100,100,570,250],"+
"panel0:Panel{bounds:[10,10,460,140] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+
"edit0:EditText{bounds:[10,55,320,75] , text:nw ,properties:{multiline:false,noecho:false,readonly:false}},"+
Sorry do not speak English.
I use a translator.
Thank you.
...dialog("Hope this helps");
function dialog(nw) {
temp = nw.toString()
alert(temp);
var dlg=
"dialog{text:'Script Interface',bounds:[100,100,570,250],"+
"panel0:Panel{bounds:[10,10,460,140] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+
"statictext0:StaticText{bounds:[10,10,300,30] , text:'Запись в словаре отсутствует, добавить запись?' ,properties:{scrolling:undefined,multiline:undefined}},"+
"statictext1:StaticText{bounds:[10,30,150
Copy link to clipboard
Copied
Example...
function dialog(nw) {
var dlg=
"dialog{text:'Script Interface',bounds:[100,100,570,250],"+
"panel0:Panel{bounds:[10,10,460,140] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+
"edit0:EditText{bounds:[10,55,320,75] , text:"+nw+",properties:{multiline:false,noecho:false,readonly:false}}}};"
var w = new Window(dlg);
w.show();
}dialog(21);
Copy link to clipboard
Copied
Does not work: "NaN"
ws is string variable.
Copy link to clipboard
Copied
Post the full code, so that we can see what's wrong.
Copy link to clipboard
Copied
Code cite in part. Alert() work properly.
for (var p = 0; p < fh
.length; p++) {for (var y = 0; y < ws.length; y++) {
lnar = ws
.split(";"); if (fh
[0].toString() == lnar[0].toString()) {
fd[fh
[1]] = fd[fh
[1]] + String(lnar[1].toString()) + ";";
s = 1;
break;
}
}
if (s == 0) {
alert(fh
[0].toString());
dialog(fh
[0].toString());
}
s = 0;
}
function dialog(nw) {
temp = nw.toString()
alert(temp);
var dlg=
"dialog{text:'Script Interface',bounds:[100,100,570,250],"+
"panel0:Panel{bounds:[10,10,460,140] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+
"statictext0:StaticText{bounds:[10,10,300,30] , text:'Запись в словаре отсутствует, добавить запись?' ,properties:{scrolling:undefined,multiline:undefined}},"+
"statictext1:StaticText{bounds:[10,30,150,50] , text:"+nw+" ,properties:{scrolling:undefined,multiline:undefined}},"+
"edit0:EditText{bounds:[10,55,320,75] , text:temp ,properties:{multiline:false,noecho:false,readonly:false}},"+
"button1:Button{bounds:[10,85,220,110] , text:'Добавить' },"+
"button2:Button{bounds:[230,85,440,110] , text:'Игнорировать' }}};";
var win= new Window(dlg,"Добавление записи");
win.center();
var done = false;
while (!done) {
var x = win.show();
if (x == 0 || x == 2) {
win.canceled = true;
done = true;
} else if (x == 1) {
done = true;
var result = validate();
if(result != true) {
alert(result);
return;
}else
{
}
}
}
function validate(){
return true;
}
}
Copy link to clipboard
Copied
dialog(21);
function dialog(nw) {
temp = nw.toString()
alert(temp);
var dlg=
"dialog{text:'Script Interface',bounds:[100,100,570,250],"+
"panel0:Panel{bounds:[10,10,460,140] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+
"statictext0:StaticText{bounds:[10,10,300,30] , text:'Запись в словаре отсутствует, добавить запись?' ,properties:{scrolling:undefined,multiline:undefined}},"+
"statictext1:StaticText{bounds:[10,30,150,50] , text:"+nw+" ,properties:{scrolling:undefined,multiline:undefined}},"+
"edit0:EditText{bounds:[10,55,320,75] , text:" + temp +",properties:{multiline:false,noecho:false,readonly:false}},"+
"button1:Button{bounds:[10,85,220,110] , text:'Добавить' },"+
"button2:Button{bounds:[230,85,440,110] , text:'Игнорировать' }}};";
var win= new Window(dlg,"Добавление записи");
win.center();
var done = false;
while (!done) {
var x = win.show();
if (x == 0 || x == 2) {
win.canceled = true;
done = true;
} else if (x == 1) {
done = true;
var result = validate();
if(result != true) {
alert(result);
return;
}else
{
}
}
}
function validate(){
return true;
}
}
Copy link to clipboard
Copied
With the number of all works and does not work with string.
Copy link to clipboard
Copied
dialog("Hope this helps");
function dialog(nw) {
temp = nw.toString()
alert(temp);
var dlg=
"dialog{text:'Script Interface',bounds:[100,100,570,250],"+
"panel0:Panel{bounds:[10,10,460,140] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+
"statictext0:StaticText{bounds:[10,10,300,30] , text:'Запись в словаре отсутствует, добавить запись?' ,properties:{scrolling:undefined,multiline:undefined}},"+
"statictext1:StaticText{bounds:[10,30,150,50] , text:'',properties:{scrolling:undefined,multiline:undefined}},"+
"edit0:EditText{bounds:[10,55,320,75] , text:'',properties:{multiline:false,noecho:false,readonly:false}},"+
"button1:Button{bounds:[10,85,220,110] , text:'Добавить' },"+
"button2:Button{bounds:[230,85,440,110] , text:'Игнорировать' }}};";
var win= new Window(dlg,"Добавление записи");
win.panel0.statictext1.text = nw;
win.panel0.edit0.text = nw;
win.center();
var done = false;
while (!done) {
var x = win.show();
if (x == 0 || x == 2) {
win.canceled = true;
done = true;
} else if (x == 1) {
done = true;
var result = validate();
if(result != true) {
alert(result);
return;
}else
{
}
}
}
function validate(){
return true;
}
}
Copy link to clipboard
Copied
Сongratulations!!!
Very thanks!