Then what invokes it in response to the input text changing from the user hitting the Backspace key?
Predictive Text...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Predictive Text...
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Predictive Text...
Richard.
The backSpace key simply changes the contents of the entry field, just like pressing, say "X", which adds that char to the mix. Every keypress invokes the resident handler, and the current contents of the entry field is used to collect matches from the master list.
Craig
The backSpace key simply changes the contents of the entry field, just like pressing, say "X", which adds that char to the mix. Every keypress invokes the resident handler, and the current contents of the entry field is used to collect matches from the master list.
Craig
Last edited by dunbarx on Wed Mar 12, 2025 7:14 pm, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 10077
- Joined: Fri Feb 19, 2010 10:17 am
Re: Predictive Text...
Well, my solution maybe clunky (and Klaus is always alarmingly eager to squash my efforts), but it was me who produced a solution first, and I do believe that without a backspaceKey handler things might get slightly problematic.
-
- Livecode Opensource Backer
- Posts: 10077
- Joined: Fri Feb 19, 2010 10:17 am
Re: Predictive Text...
Collecting matches?
I have heard of people collecting those match books from restaurants and match boxes: but matches, surely not.
I have heard of people collecting those match books from restaurants and match boxes: but matches, surely not.

Re: Predictive Text...
Richmond,
I don't think, knowing Klaus, it is personal.
I am fond of saying that we all race to answer here in this forum. A race is to some degree a competition, after all, but I think it is all in good fun.
Matches? You are rarely silly, but I am happy to see it from you.
Craig
I don't think, knowing Klaus, it is personal.

I am fond of saying that we all race to answer here in this forum. A race is to some degree a competition, after all, but I think it is all in good fun.
Matches? You are rarely silly, but I am happy to see it from you.
Craig
Re: Predictive Text...
And another thing. The filter version outputs duplicates for some reason. Mine does not, so there.
Craig

Craig
-
- Livecode Opensource Backer
- Posts: 10077
- Joined: Fri Feb 19, 2010 10:17 am
Re: Predictive Text...
Yes, well . . .

I guess the cork in my . . . slipped a bit.

Oh, and by-ther-way: I picked that book up in a third-hand sort of way in a second-hand clothes shop in Bulgaria where the price was by the kilogramme: so it was about 50 Euro cents.
A pale shadow . . . a pale shadow.
Never ceases to surprise me when perfectly decent authors who have already written readable books attempt pastiches of dead authors' stuff: pace the 57 writers who have tried their sweaty paws at James Bond novels . . .
- -
Kingsley Amis degrading himself (perhaps he knew it so adopted a fake name).
Even at 15 that did not fool me for a minute.
Last edited by richmond62 on Wed Mar 12, 2025 7:42 pm, edited 1 time in total.
Re: Predictive Text...
Richmond
I never heard of this. Is it just another entry into what Adams called "the ever increasingly misnamed Hitchhikers...trilogy"?
Craig
I never heard of this. Is it just another entry into what Adams called "the ever increasingly misnamed Hitchhikers...trilogy"?
Craig
-
- Livecode Opensource Backer
- Posts: 10077
- Joined: Fri Feb 19, 2010 10:17 am
Re: Predictive Text...
It is a pastiche written by an Irish bloke quite a long time after Douglas Adams was dead.
Re: Predictive Text...
Hi all,
First, thanks to everyone who has responded and provided code and/or sample stacks. Between everything, I…think/hope…I have managed to combine elements of the provided stacks into a relatively completed stack which seems to, for the most part work. Here is my adapted code:
One issue (and there may be others that I haven’t discovered yet) is that suppose the customer name field is populated. If I highlight all the text in the field and press the backspace key, instead of deleting the text is removes the last character which based on the above code would be expected behavior. So, if I simply want to remove all the text from the field, how could this be trapped for?
Thank you again and best regards,
Jon
First, thanks to everyone who has responded and provided code and/or sample stacks. Between everything, I…think/hope…I have managed to combine elements of the provided stacks into a relatively completed stack which seems to, for the most part work. Here is my adapted code:
Code: Select all
on keyDown KP
put KP after me
put me into tLookupString
if tLookupString is empty then
put empty into field "Results"
hide field "Results"
exit to top
else
put field 1 into tList
filter tList with (tLookupString & "*")
if tList = EMPTY then
beep
put empty into field "Results"
hide field "Results"
exit to top
end if
put tList into field "Results"
show field "Results"
end if
end keyDown
on backspaceKey
delete the last char of me
send ("keydown" & "") to me
if me = empty then
hide field "Results"
end if
end backspaceKey
Thank you again and best regards,
Jon

Re: Predictive Text...
cmhjon.
If you hilite all, or any block of text in a field and hit backspace, all the hilted text is deleted. That is normal behavior on all platforms I believe.
Are you really seeing what you say you are???
Craig
If you hilite all, or any block of text in a field and hit backspace, all the hilted text is deleted. That is normal behavior on all platforms I believe.
Are you really seeing what you say you are???
Craig
Re: Predictive Text...
Hi Craig,
the script does this, but not what the TS and user might exspect:
This will work as exspected:
Best
Klaus
the script does this, but not what the TS and user might exspect:
Code: Select all
on backspaceKey
## SIC!
delete the last char of me
...
Code: Select all
on backspaceKey
if the selectedtext of me <> EMPTY then
pass backspaceKey
end if
delete the last char of me
...
Klaus
Re: Predictive Text...
Maybe I misread your last post.
Isn't the "customer name field" the field with all your customer data? You never want to delete anything there when using your filtering routine, right?
Or is it the entry field that you want to empty with backSpace. If so then you need to add this to your script:
You must press the optionKey along with the backspace key in order to make this work. The reason is that the "keyDown" message does not recognize the backSpace key, only "rawKeyDown" does. And therefore you need to identify the action of pressing backSpace to do what you want with the optionKey modifier. You can select any of the other modifier keys if you would rather.
Craig
Isn't the "customer name field" the field with all your customer data? You never want to delete anything there when using your filtering routine, right?
Or is it the entry field that you want to empty with backSpace. If so then you need to add this to your script:
Code: Select all
on rawkeyDown tkey
if tkey = 65288 and the optionkey is down then put "" into me
pass rawkeyDown
end rawkeyDown
Craig
Re: Predictive Text...
Klaus.
I got the impression that the OP wanted a way to clear the whole data entry field in one key press, and not have to press backSpace several times to do so. Of course a button would do the job just as well.
Or neither of us yet knows exactly what he wants.
cmhjon?
Craig
I got the impression that the OP wanted a way to clear the whole data entry field in one key press, and not have to press backSpace several times to do so. Of course a button would do the job just as well.
Or neither of us yet knows exactly what he wants.
cmhjon?
Craig
Re: Predictive Text...
Hi Craig,
cmhjon wrote:
That is what my little addition does.
@Richmond
What Craig said, it is nothing personal Cpt. Cumbersome!
Not sure this is the correct translation of the german saying***, but: Teasing is a sign of affection.
***Was sich liebt, das neckt sich.
Best
Klaus
cmhjon wrote:
I understand this like cmhjon wants to have the "usual/normal" behavior of the backspacekey in a field with all of its text selected.If I highlight all the text in the field and press the backspace key, instead of deleting the text is removes the last character which based on the above code would be expected behavior. So, if I simply want to remove all the text from the field, how could this be trapped for?
That is what my little addition does.
@Richmond
What Craig said, it is nothing personal Cpt. Cumbersome!

Not sure this is the correct translation of the german saying***, but: Teasing is a sign of affection.
***Was sich liebt, das neckt sich.
Best
Klaus