I am having trouble getting a procedure for a Text Editor Object to trigger the code following the finishEditing: label. I have Tab set to finish editing, but when I tab out of the object, the procedure is not triggered. Any suggestions for troubleshooting this issue?
Make sure you have all the settings in the Text Editor Options panel set for handling the tab entry. Notice that the Procedure Trigger option should include both End Editing and Tab.
Actually, I just verified that if your code contains the
finishEditing: label, these options do not have to be checked. If Panorama sees that label in your code it will trigger the code whether those options are set or not.
So that leaves the puzzle as to why Thomas’s code isn’t working. Without more details I don’t have any suggestions.
With help from Gary Yonaites, I have learned that a .ModifyRecord will interfere with triggering a procedure that should be triggered when editing a field is finished using the finishediting: label in the object’s procedure code. That’s why my code was not working. If the .ModifyRecord procedure contains an assignment to a field, the code that follows the finishEditing: label will not be triggered. Other code, such as an assignment to a variable or a message, does not interfere with the object’s code. I suspect there is a lot more to this issue that I have not discovered, but what I know already is what lawyer’s call a trap for the unwary.
So am I correct in understanding that this problem happens with both the tab and enter keys, and not just the tab key as originally reported?
As you can see, things can get complicated when multiple items of code can be triggered by a single event.
Yes. The finishEditing: procedure fails to run whether the editing was ended by a tab or by a return. I wouldn’t consider this a big problem or a high priority, but a comment in the help page for the Text Editor Object page would help the user understand this interaction. I will suggest something there.
I think you might be right about that, so I have gone ahead and added this to Bitbucket. It may take a long time to circle back to this, but I want to preserve the research that you and Gary have done.