Control of Text Fields.
Alex Tweedly
alex at tweedly.net
Fri Nov 5 15:49:22 EDT 2021
Hi Roger. Don't know if you've seen the script I posted around 6 hour
ago ("expanded snippet").
It does the correct forward / backward key movements, and also
implements both "backspace" (delete the char to the left of the iBeam)
and "delete" (remove the char to the right of the ibeam) as well as
properly handling the case where there is a text selection rather than
just an ibeam (i.e. both delete the selection, but not any characters
outside that selection).
Alex..
On 05/11/2021 18:37, Roger Guay via use-livecode wrote:
> Very good, Richmond. It’s impressive how quickly you piss around! And, it’s close but no cigar . The arrow keys on the keyboard move the ibeam in a field w/o highlighting any text. And, the Delete key deletes the char in front of the iBeam. I thought this would be easy to duplicate in LC, but maybe not??.
>
> Why do I want to emulate these keys? Well at this point, It has become a challenge and I like challenges. BTW, the calculator that I am inspired to replicate is found in Mac Good Grapher which is bundled with the Mac. The Good Grapher Calculator has back and forward buttons and a Delete button that operate exactly as the keyboard ones
>
> Thanks for playing with this,
>
> Roger
>
>> On Nov 5, 2021, at 10:15 AM, Richmond via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> Pissed around a bit:
>>
>> https://forums.livecode.com/viewtopic.php?f=7&t=36444
>>
>> Love, Richmond.
>>
>> On 5.11.21 15:59, Roger Guay via use-livecode wrote:
>>> I want them to do exactly the same thing that the keyboard keys do!! IOW, I want to emulate the delete key and the back and forward keys.
>>>
>>> Roger
>>>
>>>> On Nov 5, 2021, at 12:33 AM, Richmond Mathewson via use-livecode <use-livecode at lists.runrev.com> wrote:
>>>>
>>>> Surely the script depends on what you want those buttons to do.
>>>>
>>>> On Fri, 5 Nov 2021 03:41 Roger Guay via use-livecode, <
>>>> use-livecode at lists.runrev.com> wrote:
>>>>
>>>>> Thanks, Alex. Sorry I didn’t make myself clear. I’m building a calculator
>>>>> stack with forward and back arrow buttons and a Delete button. What's the
>>>>> script for these buttons?
>>>>>
>>>>> Roger
>>>>>
>>>>>> On Nov 4, 2021, at 5:53 PM, Alex Tweedly via use-livecode <
>>>>> use-livecode at lists.runrev.com> wrote:
>>>>>> Hi Roger,
>>>>>>
>>>>>> I'm not sure I properly understand your question.
>>>>>>
>>>>>> here's a code snippet the moves the insertion point (in this sample,
>>>>> typing an 'f' moves it forward, 'b' moves it back). (Note this also works
>>>>> if there is some text selected - it moves the insertion to just after the
>>>>> selection, just like the arrow key does).
>>>>>>> on keydown p
>>>>>>> local t
>>>>>>> switch p
>>>>>>> case "f"
>>>>>>> put word 4 of the selectedchunk into t
>>>>>>> select after char (t+1) of me
>>>>>>> break
>>>>>>> case "b"
>>>>>>> put word 2 of the selectedchunk into t
>>>>>>> select before char (t-1) of me
>>>>>>> break
>>>>>>> end switch
>>>>>>> end keydown
>>>>>> To then delete the char in front of it, you'd do something like
>>>>>>
>>>>>> put empty into char (t+1) of me
>>>>>>
>>>>>> Hope that's close enough to what you were asking, or at least gives you
>>>>> a starting place :-),
>>>>>> Alex.
>>>>>>
>>>>>> On 04/11/2021 20:49, Roger Guay via use-livecode wrote:
>>>>>>> I simply want to be able to move the insertion iBeam in a focused field
>>>>> left and right, one char at a time (just like the left and right arrows
>>>>> keys), and then to delete the char in front of it (just like the Delete
>>>>> key). The dictionary was again of no use to me. Can someone please provide
>>>>> sample scripts?
>>>>>>> Thanks,
>>>>>>> Roger
>>>>>>> _______________________________________________
>>>>>>> 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
>>>>> _______________________________________________
>>>>> 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
>>> _______________________________________________
>>> 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
>
> _______________________________________________
> 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