Educational materials

MATLAB Example - Key Handler Callback Function

Annotations

  • Sets an element in the array to 1 for the key being pressed
  • Allows for multiple key presses to be detected and polled for successfully

Raw Source Code

function keyHandlerPressAdv(src,evnt)
% usage: keyHandlerPress(src, evnt)
% purpose: Sets the global variable to reflect the current key press
    global   gCurrentKeyPress
    
key = get(gcf,'CurrentCharacter');

% Convert to an integer
key = key-0;

gCurrentKeyPress(key) = 1;
    
end
r1 - 28 Nov 2007 - 19:03:07 - AaronStriegel
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Syndicate this site RSSATOM