Text Edit Object procedure triggers

I am starting to play with the Text Editor Object and have a question about triggering procedures. I would like the user to trigger a procedure at the end of editing (with a Return or Enter key), but I do not want to trigger a procedure when tabbing from one TEO to another TEO. Is that possible? Under Procedure Trigger, I thought that by checking “End Editing” and leaving unchecked “Tab” would do the trick, but there seems to be no difference between checking “Tab” or leaving “Tab” unchecked. I must be missing something. Any suggestions?

Sorry, that is not possible. If there is a procedure set up, it will be triggered no matter what technique was used to end editing.

However, you should be able use the info("keyboard") function to check if the tab key was the last key pressed.

if info("keyboard") = tab()

It Tab is not checked, then pressing the Tab key should enter a tab into the text, and not skip to the next Text Editor object at all. I don’t think that is what you want, so I suggest that you want to keep the Tab option checked.

You may be able to have the form do what you want with the content of the procedure. It will be triggered whether you press a tab to finish editing or return. But you can have a procedure that does something only if you have pressed return, so a tab could move to the next text editor and a return could do something else. Put something like this in the procedure for your text editor:

if info("keyboard")=cr()
    Alertsheet "You pressed return!"

Speaking of text editor end-editing behavior. If you have a form with only one text editor, and you have selected tab to end the editing, the tab key will not end the editing or trigger the procedure (return still triggers the procedure). If you put a second text editor on the form with the tab cycle turned on, even one that you can hide, a tab will end the editing and trigger the procedure.
I stumbled across this while trying to learn more about rundialog. Gary’s alert sheet procedure for getting input would be an example of using one text editor on a form. If you want tab to end the dialog, you may be frustrated, but you can do that with an invisible second text editor. Just make sure it is within the visible part of the form, otherwise your window will scroll to show your invisible text editor.

Thanks Tom, that sounds like a bug (and I verified it), so I have added it to the issue tracker.

I am wondering, however, what you mean by an “invisible text editor.” Is there an “invisible” option I forgot about and cannot now find?

By invisible text editor I just meant a text editor with no border, no focus ring, and you could make it tiny, just 1 pixel high, so the user will not see it.