Keyboard Events

Simtech Publications switchedon at hsj.com
Tue Jul 30 09:54:01 CDT 2002


Hello All:

I'm still struggling trying to get out of my Director/Lingo habits. I'm
trying to intercept simple keyboard events but I'm having problems. This
project is a simple slideshow that advances card by card using the spacebar.
So far this works fine...

on rawkeydown thekey
  if thekey = space then
    play "beep1"
    go next
  end if
end rawkeydown

However, I need to prevent the slideshow from "running away" if the user
holds the spacebar down. In Director this works...

repeat while the keypressed = " "
end repeat

Transcript doesn't like that. Any suggestions on how to bring things to a
halt until the spacebar is released?

Also, I want the user to be able to go back to the main menu by pressing the
control key at any time during the slideshow. I tried doing this in an idle
handler in the card script as follows...

on idle
  if the controlkey is down then go to cd "main menu"
end idle

This only works inconsistently. I can't explain why. Can anyone help?

Cheers... Bill Lynn, Publisher
Simtech Publications
http://www.hsj.com




More information about the use-livecode mailing list