Determine whether a key is up or down
Determines whether a key is up or down at the time the function is called, and whether the key was pressed after a previous call to GetAsyncKeyState.
So you don't need to use maltlab 'WindowButtonDownFcn' or 'java KeyPressedCallback'
VirtualKeyCode is an enumeration class for all the different keys and buttons.
See the following link for further information: https://msdn.microsoft.com/de-de/library/windows/desktop/dd375731(v=vs.85).aspx
Examples:
check mouse buttons:
mouseL = getAsyncKeyState(VirtualKeyCode.VK_LBUTTON);
mouseM = getAsyncKeyState(VirtualKeyCode.VK_MBUTTON);
mouseR = getAsyncKeyState(VirtualKeyCode.VK_RBUTTON);
check modifiers:
control = getAsyncKeyState(VirtualKeyCode.VK_CONTROL);
alt = getAsyncKeyState(VirtualKeyCode.VK_MENU);
Inspired by "ismousedpressed" [ https://de.mathworks.com/matlabcentral/fileexchange/61976-check-if-mouse-button-is-pressed?focused=7350547&tab=function ]
Citar como
Mario Koddenbrock (2024). Determine whether a key is up or down (https://www.mathworks.com/matlabcentral/fileexchange/64380-determine-whether-a-key-is-up-or-down), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Compatibilidad con las plataformas
Windows macOS LinuxCategorías
Etiquetas
Agradecimientos
Inspirado por: Check if mouse button is pressed
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
Versión | Publicado | Notas de la versión | |
---|---|---|---|
1.0.0.0 | changed title |