To create and interact with user interface elements
Greetings to everyone!
When I call a dialog, I need to pass it the value of the text (StaticText). EditText would like the text to be typed from the center (justify: "center").
I wrote the code for such a window in two versions.
in the first case, I cannot assign a value (StaticText).
In the second version, I cannot make the text in the EditText field aligned in the center.
How to make any of the options work?
var myTxt = 'figny';
// version1
var w = new Window( "dialog { \
orientation: 'row', \
st: StaticText {text:myTxt}, \
pb: Button { text: 'OK' }, \
et: EditText { characters:15, justify:'center' } \
}");
w.show();
// version2
win = new Window('dialog');
win.orientation = 'row';
win.st = win.add('statictext', undefined, myTxt);
win.bt = win.add('button', undefined, 'ok');
win.et = win.add('edittext');
win.et.characters = 15;
win.et.justify = 'center';
win.show();
