How to to type bottom to up and right to left in a field
Richard Gaskin
ambassador at fourthworld.com
Thu Sep 21 12:48:00 EDT 2017
hh wrote:
>> > hh wrote:
>> > on textChanged
>> > replace space with space in me -- or whatever
>> > end textChanged
>> Bob S. wrote:
>> Whut? All that will do is replace spaces with spaces. That will not reverse the order of the typed text.
>
> (Instead of "space" use also any other char, for example "cr")
> It works. Just try.
Indeed it does. At first glance the behavior seems at least
unintuitive. It also appears to prevent the Backspace key from having
any effect. Is it a bug? A feature?
Hmmm...
On further consideration it may make sense, since the selection is
removed by replacing the field contents, and the default selection is at
the beginning of a line.
It would seem the only way to preserve the insertion point would be to
separately trap for all relevant messages (backspaceKey, pasteKey,
dragDrop, keyDown, etc.), where you first query the selectedChunk,
perform the action, then adjust the selectedChunk according to the
length of the operation, and then restore the insertion point at the
adjusted offset.
This seems like so many things in a good scripting language: when you
want to do something ordinary, the provided behaviors make the task
uncommonly easy. But when you want to do something extraordinary, the
task is uncommonly difficult.
--
Richard Gaskin
Fourth World Systems
Software Design and Development for the Desktop, Mobile, and the Web
____________________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list