Control of Text Fields.

Alex Tweedly alex at tweedly.net
Wed Nov 10 09:28:52 EST 2021


"focusedObject" - wow, who knew ?  :-)

So it's been helpful for me.
(Some day I really will read the dictionary thoroughly).

Alex.

On 10/11/2021 03:38, Roger Guay via use-livecode wrote:
> Alex and Richmond,
>
> This discussion has been very helpful. Thank you! Please see my latest post on the forums where I offer my Formulator stack that seems to work, partly I think because I don’t lock the text of the multiple fields in my stack. Who woulda thunk?
>
> https://forums.livecode.com/viewtopic.php?f=7&t=36444 <https://forums.livecode.com/viewtopic.php?f=7&t=36444>
>
> Cheers,
>
> Roger
>
>
>> On Nov 7, 2021, at 5:51 PM, Alex Tweedly via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>>
>> On 07/11/2021 11:36, Richmond via use-livecode wrote:
>>> No hard feelings.
>>>
>>> See what I have got up to over on the Forums, and
>>>
>>> https://forums.livecode.com/viewtopic.php?f=7&t=36444
>>>
>>> PLEASE, feel free to pull the thing to bits.
>>>
>> I don't want to "pull the thing to bits". Like you, I enjoy seeing "competing" multitude of ways to do things - I can learn from them all.
>>
>> But I did have a quick look, so I'll just point out a small number of nitpicks.
>>
>> 1. the whole 'locktext' thing is weird, and causes various anomalies.
>> When I first open the stack, and click in the field, I can type digits and have them appear in the field, as you'd expect. But once I've clicked on an 'arrow-emulator' the field becomes locked and one can no longer type in characters.  Clicking *outside* the field will then free it up again, so typing becomes possible.
>>
>> 2. disappearing iBeam.
>>
>> If I position the ibeam in the middle of the text in the field, and use one of the arrow emulator buttons, the iBeam  moves properly - but then disappears (perhaps when the 'locktext' is set true).
>>
>> 3. incorrect entry position.
>>
>> As in 2 above, although the ibeam was last seen in the correct place after using the ">" button to move it to the right, if I then click on a digit button, that digit appears at the end of the field, not where it should have gone
>>
>> 4. Incorrect arrow key emulation (same problem as I mentioned in the previous email).
>>
>> If you select a chunk of text in the field, then use the left-arrow emulator button, the ibeam is positioned before the *last* character of the selection, instead of before the first.
>>
>>
>> There were a couple of others, omitted for brevity. I've created a modified version your stack with my suggested handlers, and will attempt to upload it to the forum later.
>>
>> Then there was another issue which I haven't tackled - it would mean changing lots of very similar tiny scripts, and is too tedious.
>>
>> 5. character input should replace any selection
>>
>> Just like in a regular field, if there is an active selection, typing a character (or clicking a digit button, should *replace* it, not simply add the newly typed (or clicked) digit.
>>
>>
>> I've taken my earlier handler suggestion, and broken the bits of code out into individual button scripts, which removes the apparent complexity that you disliked earlier. As far as I know, no problems have yet been found with that approach. As one example, the code for left-arrow emulator would be
>>
>>>   on mouseUp
>>>     focus on field "fWORK"
>>>     put word 2 of the selectedchunk into tFirst
>>>     put word 4 of the selectedchunk into tLast
>>>     select before char (min(tFirst, tLast)) of fld "fWORK"
>>> end mouseUp
>> I've uploaded this revised version on the forum thread.
>>
>> Best wishes,  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
> _______________________________________________
> 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