HELP: hPB with "arrowkey"

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ThierryO
Posts: 7
Joined: Thu Mar 13, 2008 11:35 am

HELP: hPB with "arrowkey"

Post by ThierryO » Wed Mar 19, 2008 10:02 am

Hi everybody,

I am developing a task in which questions are responded with arrowkeys.
But, if an key is pressed twice (or more) for the same question, the first keypress is considered as the reply for the current trial, and the other are memorized and used for the next trials, which, when they are presented, are automatically responded with the previous key presses.

How to take into account the first keypress only (and ignore the others)?

tx,
Thierry

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Wed Mar 19, 2008 1:50 pm

Hi Thierry,

Here's a quick-and-dirty script which will only allow you to type a single number per second:

Code: Select all

local sBlockKey

on keyDown pKey
  if sBlockKey then 
    beep
    exit keyDown
  end if
  if pKey is an integer then 
    put true into sBlockKey
    send "UnblockKey" to me in 2 seconds
  end if
  pass keyDown
end keyDown

on UnblockKey
  put false into sBlockKey
end UnblockKey
Hope this helped,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

ThierryO
Posts: 7
Joined: Thu Mar 13, 2008 11:35 am

Post by ThierryO » Wed Mar 19, 2008 6:21 pm

Jan,

Thank you for your help. I now use the idea of an unblock handler and replaced a 'wait' with "send" to fix the problem.

Post Reply