Copy link to clipboard
Copied
Is it possible to change focus in dialog window after input?
For instance, after the input changed (there could be any value) the focus should be on the button, so that we could press Enter on the keyboard to submit the dialog.
Same procedure as in your other thread
var w = new Window("dialog", "Example Dialog");
w.dialogGroup = w.add("group");
w.dialogGroup.el1 = w.dialogGroup.add("edittext", undefined, "Edit Text 1");
w.dialogGroup.el2 = w.dialogGroup.add("edittext", undefined, "Edit Text 2");
w.dialogGroup.el1.active = true;
w.quitBtn = w.add("button", undefined, "Ok");
w.defaultElement = w.quitBtn;
w.dialogGroup.el1.onChange = function() {
w.quitBtn.active = true;
}
w.show();
Have fun
Copy link to clipboard
Copied
Same procedure as in your other thread
var w = new Window("dialog", "Example Dialog");
w.dialogGroup = w.add("group");
w.dialogGroup.el1 = w.dialogGroup.add("edittext", undefined, "Edit Text 1");
w.dialogGroup.el2 = w.dialogGroup.add("edittext", undefined, "Edit Text 2");
w.dialogGroup.el1.active = true;
w.quitBtn = w.add("button", undefined, "Ok");
w.defaultElement = w.quitBtn;
w.dialogGroup.el1.onChange = function() {
w.quitBtn.active = true;
}
w.show();
Have fun
Copy link to clipboard
Copied
But how can I output the value of el1 element?
Copy link to clipboard
Copied
var aTxt = null;
var w = new Window("dialog", "Example Dialog");
w.dialogGroup = w.add("group");
w.dialogGroup.el1 = w.dialogGroup.add("edittext", undefined, "Edit Text 1");
w.dialogGroup.el2 = w.dialogGroup.add("edittext", undefined, "Edit Text 2");
w.dialogGroup.el1.active = true;
w.quitBtn = w.add("button", undefined, "Ok");
w.defaultElement = w.quitBtn;
w.dialogGroup.el1.onChange = function() {
aTxt = w.dialogGroup.el1.text;
w.quitBtn.active = true;
}
w.show();
alert(aTxt);
Copy link to clipboard
Copied
The only tning which is working strange now is how the dialog responds when submit the form by mouse (of course, this was not required in the original question). Now we need to click the button twice by mouse to submit it.
Copy link to clipboard
Copied
In your code or in my snippet?
Copy link to clipboard
Copied
In your snippet.
Copy link to clipboard
Copied
That's really hard. For me the snippet works as expected (but did only tried from ESTK).
Sometimes Illu scripts make strange things. Maybe try this cumbersome workaround PromptToSaveChanges / ScriptUI Default Highlighted Button
Copy link to clipboard
Copied
I commented the line
w.quitBtn.active = true;
and set onClick() function for the button and after that seems it's working as expected 🙂
Copy link to clipboard
Copied
Yes. That is the normal behavior. But I thought you want to highlighting the OK button after changing editText1.