the "backspacekey" and "keyup" handlers as wrappers
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
the "backspacekey" and "keyup" handlers as wrappers
Hallo,
what is false in that script, especially in line 2 of it (if thekey...)?
on keyup
if thekey = "backspacekey" then
delete last char of fld 16
delete last char of fld 12
else
if (lineoffset(" " & fld 12,fld 1 of stack "wbuch")) = 0 then
delete last char of fld 12 of stack "wbuch"
delete last char of fld 16 of stack "wbuch"
end if
end if
end keyup
Thanks for any hint.
chrisw
what is false in that script, especially in line 2 of it (if thekey...)?
on keyup
if thekey = "backspacekey" then
delete last char of fld 16
delete last char of fld 12
else
if (lineoffset(" " & fld 12,fld 1 of stack "wbuch")) = 0 then
delete last char of fld 12 of stack "wbuch"
delete last char of fld 16 of stack "wbuch"
end if
end if
end keyup
Thanks for any hint.
chrisw
Re: the "backspacekey" and "keyup" handlers as wrappers
Hi Chris,
check "rawkeyup" in the LC dictionary.
Best regards
Jean-Marc
check "rawkeyup" in the LC dictionary.
Best regards
Jean-Marc
https://alternatic.ch
Re: the "backspacekey" and "keyup" handlers as wrappers
Hi Chris,
waht Jean-Marc said AND you forgot the parameter in your "keyup" handler: on keyup THEKEY
Best
Klaus
waht Jean-Marc said AND you forgot the parameter in your "keyup" handler: on keyup THEKEY
Best
Klaus
Re: the "backspacekey" and "keyup" handlers as wrappers
Thank You very much!
But how it should be:
on keyup thekey
if it = backspacekey then...
that does not work!
best reagards,
chrisw
But how it should be:
on keyup thekey
if it = backspacekey then...
that does not work!
best reagards,
chrisw
Re: the "backspacekey" and "keyup" handlers as wrappers
Hi Chris,
because "backspacekey" has its own message:
Best
Klaus
because "backspacekey" has its own message:
Code: Select all
on backspacekey
## do this or that
PASS backspacekey
## or not!
end backspacekey

Best
Klaus
Re: the "backspacekey" and "keyup" handlers as wrappers
hallo, Klaus,
ind the fld-script i had
on backspacekey and on keyup
in "backspacekey" were the two lines
in "Keyup" the rest.
That does not work, because the command "delete last char" is also in the keyup. So pass backspacekey or not does not work. I ended backspacekey with "exit to top" - but that did not help either.
I was told:
In the way your code example is structured, you could set a flag that indicates when a "backspacekey" was handled. This could be reset when the "keyup" handler is called.
Alternatively you could use the "backspacekey" and "keyup" handlers as wrappers that call a particular function or command. The arguments you pass in could then inform that section of code what to do.
but indeed: I do not know how to formulate that. I am quite desperate!
Best
chrisw
ind the fld-script i had
on backspacekey and on keyup
in "backspacekey" were the two lines
in "Keyup" the rest.
That does not work, because the command "delete last char" is also in the keyup. So pass backspacekey or not does not work. I ended backspacekey with "exit to top" - but that did not help either.
I was told:
In the way your code example is structured, you could set a flag that indicates when a "backspacekey" was handled. This could be reset when the "keyup" handler is called.
Alternatively you could use the "backspacekey" and "keyup" handlers as wrappers that call a particular function or command. The arguments you pass in could then inform that section of code what to do.
but indeed: I do not know how to formulate that. I am quite desperate!
Best
chrisw
Re: the "backspacekey" and "keyup" handlers as wrappers
Hi Chris,
"backspacekey" and also "deletekey" are MESSAGES, so they will never appear in the parameter-> theKey in the keyup handler!
These can only be "trapped" with checking "rawkeyup" as Jean-Marc suggested!
So what did you finally script?
Best
Klaus
"backspacekey" and also "deletekey" are MESSAGES, so they will never appear in the parameter-> theKey in the keyup handler!
These can only be "trapped" with checking "rawkeyup" as Jean-Marc suggested!
So what did you finally script?
Best
Klaus
Re: the "backspacekey" and "keyup" handlers as wrappers
https://alternatic.ch
Re: the "backspacekey" and "keyup" handlers as wrappers
Hi Jean-Marc and Klaus,
(put pkey (= backspacekey) = 65288)
on rawkeyup pKey
if pKey = 65288 then
delete last char of fld 16
delete last char of fld 12
--exit to top
else
if (lineoffset(" " & fld 12,fld 1 of stack "wbuch")) = 0 then
delete last char of fld 12 of stack "wbuch"
delete last char of fld 16 of stack "wbuch"
end if
end if
end rawkeyup
the result is:
in fld 16 the last two chars are deleted
in fld 12 the last char
amazingly:
on rawkeyup pKey
if pKey = 65288 then
delete last char of fld 16
delete last char of fld 12
end if
end rawkeyup
brings the same effect!
would it help, if I send You the whole stack?
Best regards,
Chrisw
(put pkey (= backspacekey) = 65288)
on rawkeyup pKey
if pKey = 65288 then
delete last char of fld 16
delete last char of fld 12
--exit to top
else
if (lineoffset(" " & fld 12,fld 1 of stack "wbuch")) = 0 then
delete last char of fld 12 of stack "wbuch"
delete last char of fld 16 of stack "wbuch"
end if
end if
end rawkeyup
the result is:
in fld 16 the last two chars are deleted
in fld 12 the last char
amazingly:
on rawkeyup pKey
if pKey = 65288 then
delete last char of fld 16
delete last char of fld 12
end if
end rawkeyup
brings the same effect!
would it help, if I send You the whole stack?
Best regards,
Chrisw
Re: the "backspacekey" and "keyup" handlers as wrappers
Hi Chris,
Best
Jean-Marc
Certainly but you can upload a stack once you have 10 messages postedwould it help, if I send You the whole stack?
Best
Jean-Marc
https://alternatic.ch