Face a problem when doing keypressfcn for 'ENTER' key on keyboard

17 vues (au cours des 30 derniers jours)
Yeoh
Yeoh le 16 Mar 2011
Hi,
I wonder why everything runs well just the enter key. Part of my code as below:
function figure1_WindowKeyReleaseFcn(hObject, eventdata, handles)
switch eventdata.Key
case 'a'
set(handles.edit1,'String','A');
case 'b'
set(handles.edit1,'String','B');
case 'c'
set(handles.edit1,'String','C');
case 'd'
set(handles.edit1,'String','D');
case 'delete'
set(handles.edit1,'String','');
case 'backspace'
set(handles.edit1,'String','');
case 'enter'
set(handles.edit1,'String','');
The edit1 text box can display A, B, C, D every time I press the corresponding key on keyboard. It can display empty box when i press backspace or delete. But it cannot for the enter key. Nothing happen when I press enter. Why???
Thank you very much.

Réponse acceptée

Teja Muppirala
Teja Muppirala le 16 Mar 2011
Try using 'return' instead of 'enter'
  1 commentaire
Yeoh
Yeoh le 16 Mar 2011
Thank you very much. It solved when I change it to 'return'!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by