Key capture question.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Key capture question.
Is it possible to capture a keystroke if the stack is not active? Basically a user wants to be able to hit shift(or control or whatever)+(any function key) to be able to jump right to another card or stack without having to use the mouse to bring the stack active first. I saw backdrop but it only has mouse support and covers the whole screen anyway.
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
You can use a backscript to capture the keystrokes even if another window has focus - as long as Revolution is the active application.
Drop a button onto your stack, set its name to "MyBackscript" and set its script to:
Now you can make this button a backscript with
And now hitting F1 while holding down the shift-key will pop up the answer dialog box. You can hide the button so no one sees it, and it will still work.
HTH,
Jan Schenkel.
Drop a button onto your stack, set its name to "MyBackscript" and set its script to:
Code: Select all
on functionKey pFunctionKey
if the shiftKey is "down" and pFunctionKey = 1 then
answer "You pressed Shift-F1!"
end if
end functionKey
Code: Select all
insert the script of button "MyBackscript" into back
HTH,
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
Hmm, perhaps I was thinking too Mac/multi-window oriented, rather than asking about your application design. My solution would work if it was another window of the same application, that held the focus.
If what you're asking for is a way to trap these events even when your application is buried in the background and the user is in, say, Microsoft Word, then I'll have to disappoint you: Revolution cannot intercept these events at the system level.
Jan Schenkel.
If what you're asking for is a way to trap these events even when your application is buried in the background and the user is in, say, Microsoft Word, then I'll have to disappoint you: Revolution cannot intercept these events at the system level.
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
Re: Key capture question.
You need an external for that, one for each OS really. A project I built http://www.einspine.com doesn't record the keys but merely uses this to keep track of the number of times the user presses keys or clicks the mouse in order to measure RSI potential. It also gauges if the user might be clutching the mouse and not using it (tracks pixel movement). The app of course, needs to be running but does not need to be frontmost.Paul D wrote:Is it possible to capture a keystroke if the stack is not active? Basically a user wants to be able to hit shift(or control or whatever)+(any function key) to be able to jump right to another card or stack without having to use the mouse to bring the stack active first. I saw backdrop but it only has mouse support and covers the whole screen anyway.
Be prepared to keep remaking those externals as OS's change also. Not trivial.
-
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
- Contact:
Hi Paul D,
I'm not sure if I would be much of a help but check this out and tell me if it does the thing that you want to achieve.
KeyTracker.rev

I'm not sure if I would be much of a help but check this out and tell me if it does the thing that you want to achieve.

KeyTracker.rev
