Use enter button in inputdlg when file converted to exe
이전 댓글 표시
Hi! Is it possible for the inputdlg box to respond to the enter button instead of clicking at the ok button? I've got help to fix it when the program is executed in matlab, I'd like to be able to use the enter button when the file is converted to exe file. BR Johan
댓글 수: 2
Titus Edelhofer
2011년 6월 27일
I guess you tried to compile it? Usually the compiled version should behave like the "uncompiled" version ...
Titus
Johan
2011년 6월 28일
답변 (1개)
Jan
2011년 6월 27일
Create a copy of "inputdlg.m" e.g. as "inputdlg2.m". Search for "uicontrol(EditHandle(1))". Add this line after the following END:
uicontrol(OKHandle);
Now the OK button is selected initially and hitting ENTER activates it. If the inputdlg2 files is created in a user folder (recommended!) insert the files MATLABROOT\toolbox\matlab\uitools\private\getnicedialoglocation.m and \private\setdefaultbutton.m also in inputdlg2.m.
Most likely a completely new created dialog file would be much smaller.
댓글 수: 5
Johan
2011년 6월 28일
Johan
2011년 6월 28일
Jan
2011년 6월 28일
@Johan: I assume this depends on the initial values set by the input arguments. Please post the code you are calling INPUTDLG with.
Johan
2011년 6월 29일
Jan
2011년 6월 29일
Please read "help inputdlg". If you call INPUTDLG without default answers, the empty string is replied and STR2DOUBLE converts it to NaN. Without defining a default answer, Matlab has no chance to know, that a "1" is required.
Use this to define a default value:
inputdlg('question', 'dialog name', 1, {'1'})
카테고리
도움말 센터 및 File Exchange에서 Downloads에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!