I have a datasheet with only one field. Call it colors. I enter a color, hit return which adds a record. Enter another color, hit return, etc. Is there a way to duplicate this exact behavior on a form using a single Text Editor object? I found the info on .NewRecord but haven’t figured out how to make that work, and the number of Text Editor options has me tied in knots.
This thread seems like a good place to remind folks about a new option in Panorama X 10.1 that you may have missed. You can now have code that handles multiple Text Editor trigger events, so for example you can have one set of custom code that runs when you start editing, and another when you finish editing. This wasn’t possible before.
finishEditing:
if Color<>""
addrecord
Color=""
objectaction "myTEO","Open"
endif
If your code includes these labels (finishEditing:, startEditing: etc.), it is not necessary to check the Procedure Trigger enable options in the property panel. You can leave these unchecked, but Panorama will still trigger the code if the label is there (it will also trigger the code if these options are checked, basically the labels override the checkboxes).
One other tip – you don’t actually have to give the object a name for this application (it won’t hurt anything if you do, but it’s not necessary). Instead, you can use the `info(“clickedobjectid”) function to get the id of the object that was just being edited, like this:
objectaction info("clickedobjectid"),"open"
This would be especially handy if you were using this code in a subroutine where it might be called from different Text Editor objects at different times.
Sure, you can add whatever code you want. That was always true. What is different is that now you can perform different actions when the editor opens, when it closes, and when a key is pressed. In previous versions, it would perform the same code no matter what event had happened,
I forgot to include a link to the documentation. Look for Multiple Trigger Options on this page.