Deleting a char inside a textField via code
Richmond Mathewson
richmondmathewson at gmail.com
Sat Sep 1 05:26:17 EDT 2018
What is unfortunate is that these "possibilities" are not possible:
delete before the selectedText
delete after the selectedText
and THIS works ONLY when some text is selected (rather than before the
insertion point):
delete the selectedText
there seems to be no obvious way to work out what the character before
the insertion point is.
While it is perfectly possible to do something like this:
select before char 15 of fld "myText"
it does not seem possible to do something like this:
put the selected and get "before char 15"
What I am looking for (just in case it seems obscure) is how
to delete the char just before the insertion point without having to
touch the delete key
on my keyboard.
Richmond.
On 31/8/2018 9:30 pm, Paul Dupuis via use-livecode wrote:
> If you want to delete the last characters by script, why not something like:
>
> delete last char of fld X
>
> Or a more complex version might be
>
> put the selectedChunk into tWhere
> put word 2 of tWhere into tStart -- staring char position of the cursor
> put word 4 of tWhere into tEnd -- ending char position of the cursor
> if tStart > tEnd then -- just an insertion point
> delete char tEnd of field X -- delete the character just before the
> insertion point
> else -- some field content is selected, so
> delete char tStart to tEnd of fld X -- delete the selected field content
> end if
>
> I did this from memory, so check the dictionary for the exact
> expressions returned by the selectedChunk function.,
>
> On 8/31/2018 1:57 PM, Richmond Mathewson via use-livecode wrote:
>> Digging further . . .
>>
>> I found out that the problem appearas:
>>
>> 1. NOT to be with LiveCode.
>>
>> 2. NOT to be with MacOS.
>>
>> Because using a font other than my one works well.
>>
>> So?
>>
>> What hidden aspects of my Devawriter.ttf font are gumming up the works?
>>
>> Richmond.
>>
>> On 31/8/2018 6:44 pm, Richmond Mathewson wrote:
>>> Normally, if one were typing into a textField and made a mistake one
>>> would hit the back delete key
>>> and the mistake would vanish.
>>>
>>> How does one do this "programmatically"?
>>>
>>> Here's the (admittedly odd scenario):
>>>
>>> Unicode behaves inconsistently in various marginal cases with
>>> Devanagari script,
>>> and what happens is that the first time one sends this:
>>>
>>> put numToCodePoint(7418) after the selectedText
>>>
>>> one ends up with a useless square.
>>>
>>> But if one does this:
>>>
>>> put numToCodePoint(7418) after the selectedText
>>> put numToCodePoint(7418) after the selectedText
>>>
>>> one ends up with the useless square PRECEDED by the target glyph.
>>>
>>> So, the 'clever' work around might be to do this:
>>>
>>> put numToCodePoint(7418) after the selectedText
>>> put numToCodePoint(7418) after the selectedText
>>>
>>> followed by deleting the useless square
>>>
>>> However doing this:
>>>
>>> put numToCodePoint(65288) after the selectedText
>>>
>>> results in another useless square.
>>>
>>> Richmond.
>> _______________________________________________
>> 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