フィルターのクリア

Disable all Keys Except...

5 ビュー (過去 30 日間)
Brett
Brett 2012 年 12 月 4 日
編集済み: G GK 2019 年 2 月 19 日
Hi, I'm using psychtoolbox and I want to deactivate every key except for the ones related to my program. I know I can writing something like this:
KeysIWantDisable = [4 7 8] % 4 5 7 represent keylog values
DisableKeysForKbCheck(KeysIWantDisable)
But I was wondering if there was a way to say "disable all the keys except..." because I won't really want to keylog the entire keyboard when I'm only using 4 keys.
Any ideas will be much appreciated, you guys have made this programming experience awesome so far, Brett

回答 (3 件)

Kmy
Kmy 2018 年 2 月 23 日
It's way too late but might be useful for somebody else. You can use :
DisableKeysForKbCheck(setdiff([1:256], [keysIWantEnabled]));

Jason Ross
Jason Ross 2012 年 12 月 4 日
Why not just enumerate the keys you want to accept, and not proceed in execution until you get one of those?
You aren't disabling the keys, but you are still having largely the same effect.
This approach doesn't prevent the use of control-c or window shortcuts (function keys, alt-key combinations), either. But catching those can take extra levels of compilcation you may not want to deal with.

G GK
G GK 2019 年 2 月 19 日
編集済み: G GK 2019 年 2 月 19 日
How about disabling the Microsoft/Desktop key?

カテゴリ

Help Center および File ExchangeTiming and presenting 2D and 3D stimuli についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by