sending a Backspace to a on Keyup commnd
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 244
- Joined: Wed May 11, 2011 7:50 pm
- Location: Southern California
sending a Backspace to a on Keyup commnd
I have a need to simulate or even send a BackspaceKey to a field that is using a Keyup command.
just putting empty into the keyup focussed field does not work.
any help?
just putting empty into the keyup focussed field does not work.
any help?
Clarence Martin
chipsm@themartinz.com
chipsm@themartinz.com
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: sending a Backspace to a on Keyup commnd
What does not work? The keyUp is here correctly sent ...
For example the mouseUp below puts 8 into fld 2, as expected:
For example the mouseUp below puts 8 into fld 2, as expected:
Code: Select all
--script of fld 1
on keyUp k
put charToNum(k) into fld 2
end keyUp
--script of btn 1
on mouseUp
send "keyup numToChar(8)" to fld 1
end mouseUp
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: sending a Backspace to a on Keyup commnd
Hi.
I am not sure I am saying this well, but you may need to drill deeper into LC's capabilities than "keyDown" can provide. Try this. Make two fields. In the script of fld 1:
Type into fld 1; you can isolate the backSpace key this way. Come back with what you think about it. Works as well with "rawKeyUp".
Craig
I am not sure I am saying this well, but you may need to drill deeper into LC's capabilities than "keyDown" can provide. Try this. Make two fields. In the script of fld 1:
Code: Select all
on rawKeyDown tKey
put tKey into fld 2
end rawKeyDown
Craig
-
- VIP Livecode Opensource Backer
- Posts: 244
- Joined: Wed May 11, 2011 7:50 pm
- Location: Southern California
Re: sending a Backspace to a on Keyup commnd
Hi all.
Let me explain this a little better.
I am trying to send the backspacekey from another button to a field that has the keyup function.
I trapped the backSpace key so that I can get the keyboard ASCII code for backspace by trapping the pkey on the on MouseUp.
I was hoping to be able to send that to the field.
This is kind of complicated.
I use the backspace key with the "On keyUp" field to set up another field to do things. It works using the keyboard and that is what I want to simulate.
Let me explain this a little better.
I am trying to send the backspacekey from another button to a field that has the keyup function.
I trapped the backSpace key so that I can get the keyboard ASCII code for backspace by trapping the pkey on the on MouseUp.
I was hoping to be able to send that to the field.
This is kind of complicated.
I use the backspace key with the "On keyUp" field to set up another field to do things. It works using the keyboard and that is what I want to simulate.
Clarence Martin
chipsm@themartinz.com
chipsm@themartinz.com
-
- VIP Livecode Opensource Backer
- Posts: 9833
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: sending a Backspace to a on Keyup commnd
Backspace is among the non-printing keys which are not sent with keyUp. Why not use the backspaceKey message? If you have to use a generic handler see rawKeyUp.
Alternatively, do you need to send a keyboard message to do what you want to do? If you want to delete characters based on the selection you could do that directly without having to route that outcome through extra messages.
Alternatively, do you need to send a keyboard message to do what you want to do? If you want to delete characters based on the selection you could do that directly without having to route that outcome through extra messages.
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
-
- VIP Livecode Opensource Backer
- Posts: 244
- Joined: Wed May 11, 2011 7:50 pm
- Location: Southern California
Re: sending a Backspace to a on Keyup commnd
Hi Richard,
I have "put empty into the field" it does not have the same effect as a backspace key- in my case.
This is one that I will show the Pasadena User Group as a CHALLENGE. It may be my logic or lack of logic that's the problem.
I introduced my custom dropdown list field last meeting and this list option is where the problem shows up.
I have "put empty into the field" it does not have the same effect as a backspace key- in my case.
This is one that I will show the Pasadena User Group as a CHALLENGE. It may be my logic or lack of logic that's the problem.
I introduced my custom dropdown list field last meeting and this list option is where the problem shows up.
Clarence Martin
chipsm@themartinz.com
chipsm@themartinz.com
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: sending a Backspace to a on Keyup commnd
Unicode Character 'BACKSPACE' (U+0008)
-
- VIP Livecode Opensource Backer
- Posts: 244
- Joined: Wed May 11, 2011 7:50 pm
- Location: Southern California
Re: sending a Backspace to a on Keyup commnd
can that be sent to a field? How?
Clarence Martin
chipsm@themartinz.com
chipsm@themartinz.com
-
- VIP Livecode Opensource Backer
- Posts: 9833
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: sending a Backspace to a on Keyup commnd
True, emptying an entire field is not the same as deleting the selection. But if you want to delete the selected text you could use:
Code: Select all
put empty into the selectedText
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
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: sending a Backspace to a on Keyup commnd
Doesn't the OP simply want to remotely delete the last char of the field? That is what backspace would do if typed directly.
@Chip(?)
Might you simply rethink this and:
???
Craig
@Chip(?)
Might you simply rethink this and:
Code: Select all
on mouseUp
-- or any part of any handler anywhere
delete the last char of fld "yourField"
select after fld "yourField"
end mouseUp
Craig
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: sending a Backspace to a on Keyup commnd
Reading the original OP again it is far from clear they want to delete the LAST char.
I do think they want to delete the char just in front of the cursor insertion.
The snag about this is if the field allows the end-user to insert an insertion point (wow: there's some
dicky grammar) into a textField that also means that when the end-user sends a keyUp the
field will receive focus and, at the very least,either receive a keyDown or the SIMPLE delete signal.
Aiblins s/he is speirin after something else, whereby the insertion point has been determined in some other
way, and still wants to delete the char just in front of the cursor insertion.
This is what we should be looking at.
The Unicode "thing" for backspace is either: U+0008 or U+2408 . . .
does nothing.
This:
does this:
- -
which, while being like some sort of minimalist art, is not what we want.
I do think they want to delete the char just in front of the cursor insertion.
The snag about this is if the field allows the end-user to insert an insertion point (wow: there's some
dicky grammar) into a textField that also means that when the end-user sends a keyUp the
field will receive focus and, at the very least,either receive a keyDown or the SIMPLE delete signal.
Aiblins s/he is speirin after something else, whereby the insertion point has been determined in some other
way, and still wants to delete the char just in front of the cursor insertion.
This is what we should be looking at.
The Unicode "thing" for backspace is either: U+0008 or U+2408 . . .
Code: Select all
on keyUp KUP
if KUP = "\" then
put numToCodePoint(0x8) after field "ff"
else
--do nix
end if
end keyUp
This:
Code: Select all
on keyUp KUP
if KUP = "\" then
put numToCodePoint(0x2408) after field "ff"
else
--do nix
end if
end keyUp
- -
which, while being like some sort of minimalist art, is not what we want.
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: sending a Backspace to a on Keyup commnd
What IS needed here is a way to send a backspaceKey message.
Ouch: I can feel a headache coming on:
Ouch: I can feel a headache coming on:
Code: Select all
on keyUp KUP
if KUP = "\" then
select after field "ff"
type numToCodePoint(0x8)
type numToCodePoint(0x8)
else
--do nix
end if
end keyUp
-
- VIP Livecode Opensource Backer
- Posts: 244
- Joined: Wed May 11, 2011 7:50 pm
- Location: Southern California
Re: sending a Backspace to a on Keyup commnd
richmond2,
Sorry to cause your headache!
I will try this a bit later and let you know what happens.
Sorry to cause your headache!
I will try this a bit later and let you know what happens.
Clarence Martin
chipsm@themartinz.com
chipsm@themartinz.com
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: sending a Backspace to a on Keyup commnd
The char just behind...?Reading the original OP again it is far from clear they want to delete the LAST char.
I do think they want to delete the char just in front of the cursor insertion.
OK. Still not sure why the backSpaceKey message is required. Not that it cannot be made to work, but is it going to be always robust?
So how about this:
Code: Select all
on mouseUp
put word 4 of the selectedchunk into oldCharPos
delete char oldCharPos of fld "yourField"
select after char oldCharPos of fld "yourField"
end mouseUp
-
- VIP Livecode Opensource Backer
- Posts: 244
- Joined: Wed May 11, 2011 7:50 pm
- Location: Southern California
Re: sending a Backspace to a on Keyup commnd
Hello, again richmond62.
I just tried your suggestion.
IT WORKS!
Forget the aspirin your Elixer works!
THANKS!
I just tried your suggestion.
IT WORKS!
Forget the aspirin your Elixer works!
THANKS!
Clarence Martin
chipsm@themartinz.com
chipsm@themartinz.com