Page 1 of 1

keyUp, rawKeyUp

Posted: Fri Oct 25, 2024 9:19 am
by richmond62
Is it possible to have both of these in one script?

For instance:

Code: Select all

on rawKeyUp RKP
      put RKP into fld "myField1"
end rawKeyUp

on keyUp KUP
      put KUP into fld "myField2"
end keyUp
Possibly trying to be too clever for my own good I have a cardScript that contains a rawKeyDown, a rawKeyUp, and a keyUp statement . . . :oops:

Re: keyUp, rawKeyUp

Posted: Fri Oct 25, 2024 9:37 am
by richmond62
OK, OK: so I'm talking Bollo: can't be done.
-
TB.png
TB.png (61.21 KiB) Viewed 8830 times
-
HOWEVER; there must be another way to do this sort of thing . . .

This does NOT work:

Code: Select all

on rawKeyUp RU
   if the altKey is down then
      put RU into fld "feeld"
   else
keyUp KP
   put KP into fld "feeld"
end if
end rawKeyUp
as keyUp is NOT a command.

Re: keyUp, rawKeyUp

Posted: Fri Oct 25, 2024 10:34 am
by richmond62
In the light of the scripts listed here I wonder if I can use a script with a different order:

viewtopic.php?t=4820

However, this:

Code: Select all

on keyUp KU
   put empty into fld "feeld"
   put KU after fld "feeld"
end keyUp

on rawKeyUp RU
      put RU after fld "feeld"
end rawKeyUp
does NOT work.

But this does:

Code: Select all

on keyDown KD
   put empty into fld "feeld"
end keyDown

on keyUp KU
   put KU after fld "feeld"
   pass keyUp
end keyUp

on rawKeyUp RU
   put RU after fld "feeld"
   pass rawKeyUp
end rawKeyUp
So, I discovered that for myself.

Re: keyUp, rawKeyUp

Posted: Sat Oct 26, 2024 2:40 am
by dunbarx
I have always found that these two "families" of messages do much the same thing, though "rawKeyUp" (or down) will be sent before keyUp (or down). In a card script on a new card with a field on it:

Code: Select all

on keyUp tkey
   if tKey = "102" then put random(999) into fld 1
end keyUp

on rawkeyUp tKey
   put tKey into fld 1
   wait 30
   keyUp --comment this out and keyUp works
   keyUp tkey --comment this out and keyUp fails
end rawkeyUp
You can see that the only reason "keyUp" works at all is that the original rawKeyUp parameter was explicitly passed to it. This might be exploited is a possibility. But if not, since both messages are indeed sent each keypress, poor "keyUp" is left without a parameter

Certainly the parameter sent with either family of messages is very different, and the way those parameters are characterized may be useful in their own right.

Craig

Re: keyUp, rawKeyUp

Posted: Sat Oct 26, 2024 2:47 am
by dunbarx
I should have started at the beginning. This:

Code: Select all

on keyUp 
   put random(999) into fld 1
end keyUp

on rawkeyUp tKey
   put tKey into fld 1
   wait 30
   keyUp tkey
end rawkeyUp
Places a number from both handlers, since no key-associated parameter is specified with the "keyUp" message. It just fires without context. Does this have a possible use? I do not think so, since whatever functionality it might offer could just as easily be placed in the "rawkeyUp" handler in the first place.

Craig

Re: keyUp, rawKeyUp

Posted: Sat Oct 26, 2024 3:16 pm
by dunbarx
Richmond.

I should have started at the real beginning, the one I first played around with, and then neglected. Everything I posted was based on it:

Code: Select all

on keyUp tkey
   if tKey = "D" then put random(999) into fld 1
end keyUp

on rawkeyUp tKey
   put tKey into fld 1
   wait 30
end rawkeyUp
For "rawKeyDown", tKey is 100, the code for "D". For "keyDown", tKey is simply "D". But "100" is the only thing that appears in the field. RawKeyDown, if trapped, seems to prevent keyDown.

Craig

Re: keyUp, rawKeyUp

Posted: Sat Oct 26, 2024 5:23 pm
by richmond62
A rawKeyDown signal WILL prevent a keyDown signal unless you put a pass command in the code.