Craig wrote:
here is a slightly improved version...If not (tolerable), more work is required, and I am thinking about rethinking.
Please be aware: Once I figured out how to adapt to my own situation the keysDown() strategy you described earlier in this thread, it works *perfectly* in addressing both overly-long and repeated keypresses. So no need to refine it on my behalf.
In my case, the challenge was adapting my design to work with raw keycodes. Solved by using switch to handle each case:
(a) keysDown() = the correct *keyboard* response (e.g., 49 if the correct response was "1")
(b) keysDown() = the correct *keypad* response (e.g., 65436 if the correct response was "1")
(c) keysDown() is in "49,50,51,52,65436,65433,65435,65430" if a wrong yet allowable (1-4) key was pressed
(d) keysDown() is not in "49,50,51,52,65436,65433,65435,65430" to ignore any other keypress
And because I need also to convert the keysDown() back to the actual number (1-4) chosen:
Code: Select all
put "49,50,51,52,65436,65433,65435,65430" into tValidKeys
put itemOffset(keysDown(),tValidKeys) into tListOffset
if tListOffset < 5 then
put tListOffset into tActualNumber
else
put tListOffset - 4 into tActualNumber
end if
So that's all great! The only issue now is how to allow the clinician to intervene with some key-combination that will terminate the test if it becomes clear that the patient is too impaired or agitated to continue.
According to the LC Dictionary, keysDown() yields a comma-separated list if more than one key had been held down, but whenever I insert an answer line to see how it reports a key-combination pressed, the result is always still only one item -- which is of no help.
And no matter where I've tried to insert one of the more usual ways of identifying key-combinations into the framework of Craig's keysDown() strategy, nothing seems to work.
jeff k