Dialogs and the Enter Key operation

I have dialog created with the rundialog statement with two text editors where the user enters information. When the dialog opens, the first test editor is activated. It looks like this:

TEOpens

when the user enters something and presses tab, the second text editor is activated and the user can enter information there.
Then, the user can press the Enter key, and both text editors are de-selected. Now it it look like this:

TEFilledOut

The Ok button is set as the default. At this point, I would like the next press of the Enter key to trigger the Ok button, but, alas, it does not.

The Help page for PushButton Objects says “When a form is used as a dialog (not in a regular window), pressing the Return or Enter key when no text editor is active will automatically trigger the procedure associated with the default button (if any).” Is there a way I can make the dialog act that way? Then I would not have to leave the keyboard and click the okay button with the mouse. (I think that PanX used to work this way and stopped at some point, but I am not sure about that.)

There might be an easier way in PanX, but couldn’t you check the keystroke an see if conditions were appropriate for closure - something like If Key = return (enter) and window (dialog) = xxx and Start (End) not equal “” then …

But I don’t know the cost of a procedure that checks every keystroke. Maybe in PanX, you can attach the procedure to the window so it only checks every keystroke when that window is open.

Or, if this could be an issue where Big Apple, is saying “Hands off. We’ll take it from here. Good day sir. I say, Good Day!” and you are required to explicitly (it’s a feature, not a bug), push that button.

Note on the field labeled “End”. … I wouldn’t define a field/variable that matches any keyword in a procedure. It would be too easy for me, or the program, to get confused. I’m not saying you did that. In your example, “End” is just a label.

I believe you are correct in that it used to work sometime in the past but now seems to only work on Apple generated alerts and dialogs. I had to give up on a few things I wanted to use and go to simpler system alerts because it didn’t seem proper to have default buttons ignored by Return/Enter key strokes.

I sure thought that this worked. However, you are correct, it does not work now. I have tracked down the problem and fixed it. I’m still puzzled, however. In reviewing the source code history, I don’t see how this could ever have worked.

Anyway, hopefully you’ll find that it does work when b31 is available, which may be sooner rather than later.

Thanks.I look forward to it.