MATLAB: GUI for keyboard pressed representing the push button

callbackguide

Hi,
Does it any way to represent the keyboard pressed for the callback of pushbutton? For example, when 'A' in computer keyboard is pressed, MATLAB GUI for pushbutton1 will be triggered automatically and do the corresponding callback. When 'B' from keyboard is pressed, then GUI will do the callback for pushbutton2.
This is especially want to develop for the blind people so that they can control the GUI by keyboard without the help of computer mouse.
Hope there is some suggestion and example of coding. Thank you.

Best Answer

Yes. Simply put the callbacks for the correct pushbuttons in the keypressfcn of the figure. You may need an enormous switchyard if you have one button for each key on the keyboard.
function [] = fig_keypressfcn(varargin)
% The keypressfcn for the figure.
switch varargin{2}.Key
case 'a'
case 'b'
...