Page 1 of 3
Forward DEL
Posted: Wed Jul 22, 2020 9:59 pm
by richmond62
So . . . it is the time of year when I torture people with forcing then to make kinky "typewriters"
in dead languages in Livecode . . .
-
-
And I ended up getting what I deserved: a big mess to do with the FORWARD Delete key:
-

- Screenshot 2020-07-22 at 23.52.57.png (6.33 KiB) Viewed 6530 times
My pupil got a bit stuck here, so I tried this:
Code: Select all
on mouseUp
set the text of the selectedText to numToCodePoint(65535)
end mouseUp
But I end up getting an odd char overlaying the text that should be deleted:
-

- Screenshot 2020-07-22 at 23.59.10.png (5.37 KiB) Viewed 6530 times
Re: Forward DEL
Posted: Wed Jul 22, 2020 10:39 pm
by dunbarx
Richmond.
I had "123456789" in a feld. I did:
Code: Select all
set the text of char 4 of fld 1 to numToCodePoint(65535)
No overlay, just a replacement.
Craig
Re: Forward DEL
Posted: Thu Jul 23, 2020 7:33 am
by richmond62
No overlay, just a replacement.
That's
groovy:
BUT, what I need is the forward delete function at a cursor insertion
rather than a named char.

Re: Forward DEL
Posted: Thu Jul 23, 2020 10:40 am
by Klaus
Hi Richmond,
you could use -> the selectedchunk and check its value.
Result with NO text selected in a field: char 2 to 1 of field 1 -> word 2 > word 4!
Means you have to delete char 2 of that field in this case.
With selected text: char 1 to 8 of field 1
You decide what to delete in this case.
If there is NO insertion point in any field, the selectedchunk will return EMPTY.
Hope I understood your problem correctly.
Best
Klaus
Re: Forward DEL
Posted: Thu Jul 23, 2020 12:52 pm
by richmond62
I had a fantasy that went like this:
[pseudocode]
Code: Select all
delete char 1 after the selectedText
I also had a fairly bad afternoon snooze dream where I chopped a string at a certain point, deleted the first
char of the second string and then recombined them . . .
-
-
That's how I do that sort of thing in BBC BASIC from 1981.
What is mind-blowing is that I learnt how to do that, late, in 1988: AND I still remember
how to do it.
Re: Forward DEL
Posted: Thu Jul 23, 2020 2:02 pm
by dunbarx
@Klaus.
The issue, I thought, was that Richmond was getting some sort of weird overlay, not that he couldn't identify the chunk of interest.
@Richmond.
Are you pointing out that small blotch that lies over the second to last char in the example you posted? That this blotch has plopped down over an existing char instead of replacing it?
Craig
Re: Forward DEL
Posted: Thu Jul 23, 2020 2:17 pm
by Klaus
Hi Craig,
yes, but he also wrote:
BUT, what I need is the forward delete function at a cursor insertion rather than a named char.
So I was wondering why Richmond tried to REPLACE a character in that case!? OK, it is Richmond...
Best
Klaus
Re: Forward DEL
Posted: Thu Jul 23, 2020 3:33 pm
by richmond62
I did not try to REPLACE a char.
what I did try to do was implement Forward Delete programmatically, so an end-user,
clicking on a button could delete a char in a line of text directly ahead of the insertion point.
-
-
But 0x7F throws a bluey.
And LiveCode seems unable to do this sort of thing:
-
-
https://www.aivosto.com/articles/contro ... lass=Print
Re: Forward DEL
Posted: Thu Jul 23, 2020 3:33 pm
by dunbarx
OK, it is Richmond
Ah. Of course.
Craig
Re: Forward DEL
Posted: Thu Jul 23, 2020 3:39 pm
by dunbarx
Richmond.
Can't you just:
Code: Select all
on rawkeyDown tKey
if tKey = 65535 then delete char word 2 of the selectedChunk + 1 of fld 1
end rawkeyDown
Craig
Re: Forward DEL
Posted: Thu Jul 23, 2020 3:52 pm
by Klaus
richmond62 wrote: ↑Thu Jul 23, 2020 3:33 pm
I did not try to REPLACE a char.
Sorry, my fault, did not know the "background" of that action.
Re: Forward DEL
Posted: Thu Jul 23, 2020 4:51 pm
by richmond62
dunbarx wrote: ↑Thu Jul 23, 2020 3:39 pm
Richmond.
Can't you just:
Code: Select all
on rawkeyDown tKey
if tKey = 65535 then delete char word 2 of the selectedChunk + 1 of fld 1
end rawkeyDown
Craig
Not really:
-
-
With the cursor inserted just before the red char it should delete the red char,
but the blue one is deleted instead.

Re: Forward DEL
Posted: Thu Jul 23, 2020 4:53 pm
by richmond62
These:
-
-
-
Throw blueys (as you can see).
Re: Forward DEL
Posted: Thu Jul 23, 2020 5:02 pm
by Klaus
word 1 of the selectedchunk = CHAR!
See my first posting.
Will work with parens:
...
delete char (word 2 of the selectedchunk) of fld "fWriter"
...
Re: Forward DEL
Posted: Thu Jul 23, 2020 5:05 pm
by richmond62
Mucking Fagic!
Now, Please, explain the underlying logic in that statement:
Code: Select all
delete char (word 2 of the selectedchunk) of fld "fWriter"
Why should the char directly in front of the cursor be be described as "word 2 of the selectedChunk"
(especially as nothing is selected)?