Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recall Keyboard Entrees

Status
Not open for further replies.

pixelpp

Technical User
Apr 9, 2001
12
0
0
US
I am working on a project in 8.5, in which I need the user to be able to enter a number 1 to 5, during an question/answer animation.

At the end, the program will recall the number entered by the user and compare it to a series of pre-defined variables which will then show the user what the correct answer is and what they picked, and how long it toom them to answer the question.

I'm trying to break this all down in some Lingo books and hitting snags...any help would be appreciated.

Pixel
 
Do you want to store the first key then ignor any other, or record the last hit key?

Either way the basis is the same. Use a global variable to store the last hit key (make sure you clear the value when your next question starts). Also use a global variable to store the milliseconds when you start the question, and another for when the user hits a key.
Now you will need a keydownscript that records the keycode and the time when they hit the key. Have the script check if the time > 0 to know if it was the first time a key was hit for that question.

on mykeydownscript
global gKeyHitTimer, gKeyHitCode
if gKeyHitTimer = 0 then ' ignore any more keypresses
gHitCode = the keycode
gKeyHitTimer = the milliseconds
end if

end

Now you have all the data you need to use at the end of your question. When the next question starts just set gKeyHitTimer =0 and gKeyHitCode = void.

hope this is enough info.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top