Control of Text Fields.

Richmond richmondmathewson at gmail.com
Sun Nov 7 04:01:44 EST 2021


I did not mean "competing" in the sense of "b*gger you", I meant it in the
sense of healthy competition.

"But having said that:  your "left-arrow' emulation gets it wrong if 
there is a chunk selection active."

Quite possible as I spent about 15 minutes on that yesterday between 
raking up dead leaves,
drilling through the metal head of a broken rake to screw it onto a 
wooden handle, and a whole
slew of other things such as talking to my son in Lilongwe re setting up 
discarded PCs out
there (Malawi) with Xubuntu and a programming suite that has recently 
been effectively abandoned.

I have a sackload of kids writing that has just arrived via Viber that 
has to be addressed:
after which I'll have a look at my "half cock job" and see if I can 
tweak it.

Richmond.

On 7.11.21 2:44, Alex Tweedly via use-livecode wrote:
>
> On 06/11/2021 19:04, Richmond via use-livecode wrote:
>> My competing version is now "up":
>>
>> https://forums.livecode.com/viewtopic.php?f=7&t=36444&p=210241#p210241
>>
>> Richmond.
>
> Don't you mean "my cooperating version ..."; surely the use-list is 
> about helpful cooperatin and collaborative suggestions, not about 
> competing :-)
>
>
> But having said that:  your "left-arrow' emulation gets it wrong if 
> there is a chunk selection active.
>
> left-arrow should position the iBeam to the left of the selection, 
> while this code positions it to the left of the rightmost character of 
> the selection.
>
> Alex.
>
>>
>> On 5.11.21 23:08, Alex Tweedly via use-livecode wrote:
>>>
>>> On 05/11/2021 20:18, Roger Guay via use-livecode wrote:
>>>> Alex, I did not see that and it is not in my mailbox. Would you 
>>>> please send it again?
>>>>
>>>> Thanks,
>>>> Roger
>>>
>>> Here it is again, below.
>>>
>>> Or download the sample stack at 
>>> https://tweedly.org/downloads/calcbuttons.livecode
>>>
>>>  - not as pretty as Richmond's, doesn't even have all the digits ...)
>>>
>>> Previously I said:
>>>
>>> Here's an expanded snippet. The input is in a field called "fInput", 
>>> the buttons are all in a group, and handled by the group script 
>>> (saves having many tiny almost identical scripts).
>>>
>>> The script  uses the name of the target - but since I would never, 
>>> ever have a control named as a number, the digit buttons use their 
>>> label instead.
>>>
>>> If the user cannot select a chunk of text then some of this could be 
>>> shortened.
>>>
>>>
>>>> on mouseup
>>>>    if the target = me then
>>>>       -- click in the background in the group
>>>>       exit mouseup
>>>>    end if
>>>>    local tChunk
>>>>    focus on fld "fInput"
>>>>    put the selectedchunk into tChunk
>>>>    if the label of the target is a number then
>>>>       put the label of the target into the selectedchunk
>>>>       exit mouseUp
>>>>    end if
>>>>    local tFirst, tLast
>>>>    put word 2 of tChunk into tFirst
>>>>    put word 4 of tChunk into tLast
>>>>    switch the short name of the target
>>>>       case "go left"
>>>>          select before char (min(tFirst, tLast)) of fld "fInput"
>>>>          break
>>>>       case  "go right"
>>>>          select after char (max(tFirst, tLast)) of fld "fInput"
>>>>          break
>>>>       case "Del"
>>>>          -- remove the selection, or the char *after* the ibeam
>>>>          if tFirst <= tLast then
>>>>             put empty into char tFirst to tLast of fld "fInput"
>>>>          else
>>>>             put empty into char (tFirst) of fld "fInput"
>>>>          end if
>>>>          break
>>>>       case "BS"
>>>>          -- remove the selection, or the char *before* the ibeam
>>>>          if tFirst <= tLast then
>>>>             put empty into char tFirst to tLast of fld "fInput"
>>>>          else
>>>>             put empty into char (tFirst-1) of fld "fInput"
>>>>          end if
>>>>          break
>>>>          -- all the other keys !!
>>>>       default
>>>>    end switch
>>>> end mouseup
>>>
>>> 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
>
> _______________________________________________
> 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