shortcut for function keys (F8;F9)[SOLVED]
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
shortcut for function keys (F8;F9)[SOLVED]
Hi to all,
Is there a way to make a shortcut for a button without the prior Ctrl or Alt or Shift keys ?
I can have Ctrl+F9, Shift+F9, etc., but I didn't find yet how to have only F9, or F8 keys.
Any idea ?
Kind regards, Jean-Paul.
Is there a way to make a shortcut for a button without the prior Ctrl or Alt or Shift keys ?
I can have Ctrl+F9, Shift+F9, etc., but I didn't find yet how to have only F9, or F8 keys.
Any idea ?
Kind regards, Jean-Paul.
Last edited by atout66 on Tue Apr 22, 2014 7:56 pm, edited 3 times in total.
Discovering LiveCode Community 6.5.2.
Re: shortcut for function keys (F8;F9)
Hi.
Check out "rawKeyDown" in the dictionary.
This is a message, and you can use 65474 and 65475 as tools to do whatever you need to.
Craig
Check out "rawKeyDown" in the dictionary.
This is a message, and you can use 65474 and 65475 as tools to do whatever you need to.
Craig
Re: shortcut for function keys (F8;F9)
And also check the entry for the "functionkey" message 

Re: shortcut for function keys (F8;F9)
Hmmm.
Did I misunderstand your question? Does this do what you want? In the card script:
in a button script:
Sort of the same idea. Do you see why?
Craig
Did I misunderstand your question? Does this do what you want? In the card script:
Code: Select all
on functionKey var
if var = 5 then answer random(999)
end functionKey
Code: Select all
on mouseUp
send "functionKey" && "5" to this card
end mouseUp
Craig
Re: shortcut for function keys (F8;F9)
Sounds more like this (in the card script):

Code: Select all
on functionkey tKEy
if tKey = 3 then
send "mouseup" to btn "that namely button that shall accept a function key as shortcut, YO!"
end if
end functionkey

Re: shortcut for function keys (F8;F9)
Yes Craig, I see why, and the "functionkey" is exactly what I was looking for.
So I've put this code in the stack and it works fine
I suppose that if the handler is in the stack I can remove the "pass functionKey", right ?
Thanks to all of you
Kind regards, Jean-Paul.
So I've put this code in the stack and it works fine

Code: Select all
on functionKey theKey
if theKey is 9 then send mouseUp to button "BttF9"
else pass functionKey
end functionKey
Thanks to all of you

Kind regards, Jean-Paul.
Discovering LiveCode Community 6.5.2.
Re: shortcut for function keys (F8;F9)[SOLVED]
It's strange because the script works with the <if> statement but not with the <switch> one ?
This code produce nothing
Why not
Code: Select all
on functionKey theKey
switch theKey
case theKey is 11
send mouseUp to button "BttF11"
break
case theKey is 12
send mouseUp to button "BttF12"
break
default
pass functionKey
end switch
end functionKey

Why not

Discovering LiveCode Community 6.5.2.
Re: shortcut for function keys (F8;F9)
After some tries here is what I did finally in the code of the stack:
It works but the <pass> command makes an error while compiling, so that's why I leave as a comment...
Thanks and kind regards, Jean-Paul.
Code: Select all
on functionKey theKey
if theKey is 12 then
send mouseUp to button "BttF12"
else if theKey is 11 then
send mouseUp to button "BttF11"
--else pass functionKey
end if
Thanks and kind regards, Jean-Paul.
Discovering LiveCode Community 6.5.2.
Re: shortcut for function keys (F8;F9)
Try this:

Code: Select all
on functionKey theKey
switch theKey
case 11
send "mouseUp" to button "BttF11"
break
case 12
send "mouseUp" to button "BttF12"
break
default
pass functionKey
break
end switch
end functionKey

Re: shortcut for function keys (F8;F9)
Hi.
What Klaus said.
Your construction is not syntactically correct, though it seems to read logically. When you set up a "switch", you have to think of each "case" as the VALUE you want to test, not a CONDITIONAL. Do you see that? It actually makes for a simpler control structure.
Read Klaus' example, and this should fall into place right away. Now you can try thinking about the following:
case thekey is 11
This will not throw an error, though, as you discovered, it did not work. Why? What does the phrase "thekey is 11" resolve to, that the case line had to deal with? 10 points if you write back with the answer today.
Craig
What Klaus said.
Your construction is not syntactically correct, though it seems to read logically. When you set up a "switch", you have to think of each "case" as the VALUE you want to test, not a CONDITIONAL. Do you see that? It actually makes for a simpler control structure.
Read Klaus' example, and this should fall into place right away. Now you can try thinking about the following:
case thekey is 11
This will not throw an error, though, as you discovered, it did not work. Why? What does the phrase "thekey is 11" resolve to, that the case line had to deal with? 10 points if you write back with the answer today.
Craig
Last edited by dunbarx on Tue Apr 22, 2014 11:07 pm, edited 1 time in total.
Re: shortcut for function keys (F8;F9)
Arrrghh ! I got it now
Thanks to you, I didn't understand that the <case> statement expected a pure value
I was used to code otherwise, that's why
Kind regards, Jean-Paul.

Thanks to you, I didn't understand that the <case> statement expected a pure value

I was used to code otherwise, that's why

Kind regards, Jean-Paul.
Discovering LiveCode Community 6.5.2.
Re: shortcut for function keys (F8;F9)[SOLVED]
This:
will also work, spot the difference! 
Code: Select all
on functionKey theKey
switch
case theKey = 11
send "mouseUp" to button "BttF11"
break
case theKey = 12
send "mouseUp" to button "BttF12"
break
default
pass functionKey
end switch
end functionKey

Re: shortcut for function keys (F8;F9)[SOLVED]
Klaus, it's strange because to me it didn't work previously.
Now, I stop working but I'll test your code tomorrow.
Good night
Kind regards, Jean-Paul.
Now, I stop working but I'll test your code tomorrow.
Good night

Kind regards, Jean-Paul.
Discovering LiveCode Community 6.5.2.
Re: shortcut for function keys (F8;F9)[SOLVED]
Bonjour Jean-Paul.,
Best
Klaus
my latest script of DIFFERENT ("spot the DIFFERENCE") than your first script!atout66 wrote:Klaus, it's strange because to me it didn't work previously.

Best
Klaus
Re: shortcut for function keys (F8;F9)[SOLVED]
@Klaus:
Ah, I see... you use "=" when I used "is", ie:
case theKey = 11(good) instead of
case theKey is 11(wrong), right ?
Thank you for your teachings
Kind regards, Jean-Paul.
Ah, I see... you use "=" when I used "is", ie:
case theKey = 11(good) instead of
case theKey is 11(wrong), right ?
Thank you for your teachings

Kind regards, Jean-Paul.
Discovering LiveCode Community 6.5.2.