Hi.
i have been fooling around with this, and deleted a couple of posts because after more fooling, I found them to be wanting.
When you type into a typewriter, as you approach the right side you manually return the carriage to the next line before it is too late. It is up to you not to leave yourself in the middle of a word. This is all done visually. It is only with text editors that you can type away blindfolded and the software will format properly as you go.
So here is another experiment, if anyone but me cares anymore:
Code: Select all
on textChanged
if the right of me - item 1 of the selectedLoc < 40 then --40 is subject to tweaking
set the currentText of me to the currentText of me & return & the last line of me
put return after me
end if
if the number of lines of me > 5 then --5 is arbitrary. It depends on the field height
delete line 1 of me
select after me
end if
end textChanged
This doesn't like actual returns, but if you just type away it works as I think you meant. It is a kludge that relies on the whole text being saved in a custom property ("the currentText" of the field) so you can get it back one day. It is unsatisfying as a kludge because of that. It is also unsatisfying in that the last line is not (yet) saved until it passes the right side limit (40 in the example)
If you still want to pursue this let me know. The action seems to do what you want, but it also has complications. I just like to play with LC.
Craig