Skip to content

Commit bcca2cf

Browse files
committed
make getResponse abort if escape key is pressed
- this will only work during the "check"
1 parent 90dcc06 commit bcca2cf

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

getResponse.m

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,8 @@
8181
case 'check'
8282
responseEvents = getAllKeyEvents(responseEvents, deviceNumber, getOnlyPress);
8383

84-
responseEvents = getAllKeyEvents(responseEvents, responseBox, getOnlyPress);
85-
86-
checkAbort(cfg)
87-
84+
checkAbortGetResponse(responseEvents, cfg);
85+
8886
case 'flush'
8987
KbQueueFlush(deviceNumber);
9088

@@ -162,6 +160,16 @@
162160

163161
end
164162

163+
function checkAbortGetResponse(responseEvents, cfg)
164+
165+
if isfield(responseEvents, 'keyName') > 0 && ...
166+
any( ...
167+
strcmpi({responseEvents(:).keyName}, cfg.keyboard.escapeKey)...
168+
)
169+
errorAbortGetReponse(responseEvents)
170+
end
171+
end
172+
165173

166174
function talkToMe(action)
167175

0 commit comments

Comments
 (0)