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

Alex Tweedly alex at tweedly.net
Wed Sep 20 17:57:12 EDT 2017


On 20/09/2017 22:44, Mike Bonner via use-livecode wrote:
> If "textchanged" triggers on paste, you can probably use that..

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.

Alex.
> On Wed, Sep 20, 2017 at 3:40 PM, Alex Tweedly via use-livecode <
> use-livecode at lists.runrev.com> wrote:
>
>> Thanks for the prompt Mike.
>>
>> Short answer - don't know yet, though I suspect I'm going to have to find
>> out.
>>
>> I do not currently have "mobile text field objects" - all I have are just
>> standard LC fields, so returninfield is all I need for the 'return' part of
>> the problem - no need for 'inputReturnKey'.
>>
>> However, I also want to trap any attempt to paste in text containing CRs;
>> I can do that for traditional platforms with a 'pasteKey' handler - but
>> that doesn't seem to apply to LC fields on mobile, and also there doesn't
>> appear to be any direct equivalent for mobile text fields (though there may
>> be other ways to achieve the same result on mobile text fields - I really
>> haven't looked at them yet).
>>
>> In fact, maybe that's the question I *should* ask.
>>      "Should i be  (can I reasonably get away with) using LC fields in an
>> app targeted for mobiles, or do I really need to use mobile text fields ?
>>
>> Thanks
>> Alex.
>>
>> On 20/09/2017 17:01, Mike Kerner via use-livecode wrote:
>>
>>> did that work, alex?
>>>
>>> On Mon, Sep 18, 2017 at 4:41 PM, Mike Kerner <MikeKerner at roadrunner.com>
>>> wrote:
>>>
>>> If you have a mobile text field object, then have you looked at
>>>> inputReturnKey?
>>>>
>>>>
>>>> On Mon, Sep 18, 2017 at 4:17 PM, Alex Tweedly via use-livecode <
>>>> use-livecode at lists.runrev.com> wrote:
>>>>
>>>> I'm sure there must be an easy way I'm missing ..... he said in hope :-)
>>>>> I want a field to contain a single line of data - i.. no CRs.
>>>>>
>>>>> I've done the easy bit (a handler for returninfield).
>>>>>
>>>>> I can even do the moderate bit -  a 'pastekey' handler, and check for
>>>>> CRs
>>>>> in the clipboard - but that doesn't apply to mobile (or at least, the
>>>>> dict
>>>>> says it doesn't).
>>>>>
>>>>> Is there any way to handle it on mobile ?
>>>>>
>>>>> Thanks
>>>>> Alex.
>>>>>
>>>>> _______________________________________________
>>>>> use-livecode mailing list
>>>>> use-livecode at lists.runrev.com
>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>> subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>
>>>>
>>>>
>>>> --
>>>> On the first day, God created the heavens and the Earth
>>>> On the second day, God created the oceans.
>>>> On the third day, God put the animals on hold for a few hours,
>>>>      and did a little diving.
>>>> And God said, "This is good."
>>>>
>>>>
>>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode






More information about the use-livecode mailing list