Get "RETURN" key press using "CurrentCharacter" returns and empty string.
Ältere Kommentare anzeigen
Dear all,
I am tryiing to write a GUI in which the user must enter the command (RETURN or DELETE) from the keyboard. For that purpose, I wrote a code where I set the 'KeyPressFcn' to read the key pressed by the user. The mais problem is that when the user types "RETURN" or "DELETE" all I get is an empty string.
Here is the code:
function getKey(axeshandle)
fig = ancestor(axeshandle, 'figure');
set(fig, 'KeyPressFcn', @keyRead);
uiwait(fig);
function keyRead(src, callback)
key = get(fig, 'CurrentCharacter');
strcmp(key, 'return')
class(key)
end
end
Any idea on how can I solve this?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu MATLAB Report Generator finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!