Dialog close with return key

How do you close a dialog (jscript and the dialog maker dialog) with the return button on the keyboard instead of clicking the OK button, please ?

Return will activate the button that has Default Button = True, if any. That's usually the OK button.

(Provided focus isn't on a control that uses return for something else, e.g. a multi-line edit control.)

image
focus is on edit control

Looks like return should click OK there, at least from the screenshot.

hmmm, pressing return (many times) does nothing.

If you attach the full script + resources, we can look at it. Otherwise I'm just left here trying to guess from a screenshot. :slight_smile:

As requested
Iconset Maker V2.dcf (50.2 KB)
montage.zip (12.4 MB)

Your code is ignoring clicks on the OK button when the button doesn't have focus:

        if (msg.event === "click" && dialog.Control("button1").focus === true) {

Remove the focus test and it should work OK.

Great, many thanks.