The enter key in the simplified test code below is not allowing users to create a new line within the edit text field (as expected). Instead, the modal is being submitted. The code works properly on OSX but not Windows.
I've mostly tried eventListener related solutions. So enterKey, onEnterKey, onChange, change, etc - then assigning them to different elements in the interface. Haven't been able to get those event listeners to fire, but if I could, would try event.preventDefault() or event.stopPropogation() as well. No luck yet.
var modal = new Window("dialog");
modal = addFilenamesPanel(modal)
/*
Commenting 'addSubmissionButtonsGroup' fixes the issue.
So maybe there is problematic a event listener or
propogation occurring within the submission buttons.
*/
modal = addSubmissionButtonsGroup(modal)
modal.show();
function addFilenamesPanel(modal) {
modal.filenamesPanel = modal.add(
"panel",undefined,"Filenames"
);
var panel = modal.filenamesPanel;
/*
'enterKeySignalsOnChange' fixes issue
on OSX but not Windows 10.
*/
panel.filenamesText = panel.add(
"EditText",undefined,"",{
multiline: true,
enterKeySignalsOnChange: true
}
)
panel.filenamesText.minimumSize = [400,200];
return modal
}
function addSubmissionButtonsGroup(modal) {
modal.submissionButtons = modal.add(
"group", undefined, "submit"
);
modal.submissionButtons.cancel = addButton(
modal.submissionButtons,"cancel",false
);
modal.submissionButtons.ok = addButton(
modal.submissionButtons,"ok",true
);
return modal
function addButton(group,buttonName,response) {
group.add(
"button", undefined, buttonName,
{name: buttonName}
)
group.addEventListener( "click", function() {
return response
});
return group
}
}
visualExplanation-a566bafa-19da-4262-8437-100133aa6ab5-1937277580.png