Forward DEL

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Forward DEL

Post by richmond62 » Wed Jul 22, 2020 9:59 pm

So . . . it is the time of year when I torture people with forcing then to make kinky "typewriters"
in dead languages in Livecode . . .
-
Screenshot 2020-07-22 at 23.51.16.png
-
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
Screenshot 2020-07-22 at 23.52.57.png (6.33 KiB) Viewed 6526 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
Screenshot 2020-07-22 at 23.59.10.png (5.37 KiB) Viewed 6526 times

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10319
Joined: Wed May 06, 2009 2:28 pm

Re: Forward DEL

Post by dunbarx » Wed Jul 22, 2020 10:39 pm

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Forward DEL

Post by richmond62 » Thu Jul 23, 2020 7:33 am

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. :?

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Forward DEL

Post by Klaus » Thu Jul 23, 2020 10:40 am

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Forward DEL

Post by richmond62 » Thu Jul 23, 2020 12:52 pm

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 . . .
-
Screenshot 2020-07-23 at 14.51.25.png
-
That's how I do that sort of thing in BBC BASIC from 1981. 8)

What is mind-blowing is that I learnt how to do that, late, in 1988: AND I still remember
how to do it.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10319
Joined: Wed May 06, 2009 2:28 pm

Re: Forward DEL

Post by dunbarx » Thu Jul 23, 2020 2:02 pm

@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

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Forward DEL

Post by Klaus » Thu Jul 23, 2020 2:17 pm

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... :D


Best

Klaus

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Forward DEL

Post by richmond62 » Thu Jul 23, 2020 3:33 pm

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.
-
Screenshot 2020-07-23 at 16.03.22.png
-
But 0x7F throws a bluey.

And LiveCode seems unable to do this sort of thing:
-
Screenshot 2020-07-23 at 15.36.46.png
-
https://www.aivosto.com/articles/contro ... lass=Print
Last edited by richmond62 on Thu Jul 23, 2020 3:34 pm, edited 1 time in total.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10319
Joined: Wed May 06, 2009 2:28 pm

Re: Forward DEL

Post by dunbarx » Thu Jul 23, 2020 3:33 pm

OK, it is Richmond
Ah. Of course.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10319
Joined: Wed May 06, 2009 2:28 pm

Re: Forward DEL

Post by dunbarx » 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

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Forward DEL

Post by Klaus » Thu Jul 23, 2020 3:52 pm

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Forward DEL

Post by richmond62 » Thu Jul 23, 2020 4:51 pm

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:
-
Screenshot 2020-07-23 at 18.47.52.png
-
With the cursor inserted just before the red char it should delete the red char,
but the blue one is deleted instead. 8)

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Forward DEL

Post by richmond62 » Thu Jul 23, 2020 4:53 pm

These:
-
Screenshot 2020-07-23 at 18.50.36.png
-
Screenshot 2020-07-23 at 18.51.14.png
-
Throw blueys (as you can see).

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Forward DEL

Post by Klaus » Thu Jul 23, 2020 5:02 pm

word 1 of the selectedchunk = CHAR! 8)
See my first posting.

Will work with parens:
...
delete char (word 2 of the selectedchunk) of fld "fWriter"
...

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Forward DEL

Post by richmond62 » Thu Jul 23, 2020 5:05 pm

Mucking Fagic! :D

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)?

Post Reply