Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to pass a variable in EditText?

New Here ,
Jun 01, 2013 Jun 01, 2013

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.


TOPICS
Scripting
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Jun 01, 2013 Jun 01, 2013

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

...
Translate
Valorous Hero ,
Jun 01, 2013 Jun 01, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 01, 2013 Jun 01, 2013

Does not work: "NaN"

ws is string variable.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 01, 2013 Jun 01, 2013

Post the full code, so that we can see what's wrong.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 01, 2013 Jun 01, 2013

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;

    }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 01, 2013 Jun 01, 2013

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


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 01, 2013 Jun 01, 2013

With the number of all works and does not work with string.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 01, 2013 Jun 01, 2013

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


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 01, 2013 Jun 01, 2013
LATEST

Сongratulations!!!

Very thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines