0

I have the following code to build a UI in ExtendScript:

var dlgValues = new Object();
dlgValues.edittext = "string";

var dlg = "dialog {text: 'Teste', alignChildren: 'fill', \
        panel: Panel {orientation: 'column', \
            group: Group {orientation: 'row', \
                et: EditText {text: "+ dlgValues.edittext +", characters: 40} \
            } \
        }\
         \
    }";
var win = new Window(dlg);

win.show();

I'm trying to use a variable dlgValues to insert a value in a resource string UI but it works only if I use numbers.

For example, dlgValues.edittext = "string"; returns "NaN" in the EditText box instead of "string". If it is a number, like dlgValues.edittext = "3"; everything wotks well.

My qUestion is: How can I use a variable to input string values in an EditText?

I'm not considering to use: win.panel.group.et.text = "string"

Christine
  • 5,441
  • 4
  • 37
  • 59

1 Answers1

0

I found the answer by myself, I hope this is useful for someone struggling to find documentation about resource string.

Inside the resource script the variable must be surrounded by apostrophes in order to work with strings:

var dlgValues = new Object();
dlgValues.edittext = "string";

var dlg = "dialog {text: 'Test', alignChildren: 'fill', \
        panel: Panel {orientation: 'column', \
            group: Group {orientation: 'row', \
                et: EditText {text: '"+ dlgValues.edittext +"', characters: 40} \
            } \
        }\
         \
    }";
var win = new Window(dlg);

win.show();