Constraining an input field's contents to be a single line.

hh hh at
Thu Sep 21 06:26:51 EDT 2017

Did you already try the following?
This works here, also with pasted text.

on textchanged
  lock screen; lock messages
  put the selectedChunk into sc
  replace cr with space in me -- or with empty
  select sc
  unlock screen; unlock messages
end textchanged

> > Mike B. wrote:
> > If "textchanged" triggers on paste, you can probably use that..
> Alex T. wrote
> textchanged does trigger - but *after* the text has appeared. With 
> returninfield and pastekey I get the message first - and can prevent the 
> character being inserted.
> In order to use textchanged, I'll need to keep a local copy of the field 
> content so that if I do find a CR I can restore the previous content and 
> selection point - but on a very quick try that does seem to work OK.
> I'll have to check it out more thoroughly, and then try it on mobile, 
> but it sounds like it should work -  thanks.

More information about the Use-livecode mailing list