필터 지우기
필터 지우기

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

조회 수: 5 (최근 30일)
Yeoh
Yeoh 2011년 3월 16일
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.

채택된 답변

Teja Muppirala
Teja Muppirala 2011년 3월 16일
Try using 'return' instead of 'enter'
  댓글 수: 1
Yeoh
Yeoh 2011년 3월 16일
Thank you very much. It solved when I change it to 'return'!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by