Matlab modify inputdlg buttons

13 vues (au cours des 30 derniers jours)
zhi zhu
zhi zhu le 21 Mar 2017
Réponse apportée : ES le 21 Mar 2017
I am writing a program using inputdlg function, and inputdlg came with a dialog box with an 'OK' and 'cancle' button. And I do not wish to quit when clicking the cancle button, are there's anyways I could delete this button or modify this button to become a 'retry' instead?

Réponse acceptée

ES
ES le 21 Mar 2017
Cancel and OK are hardcoded in inputdlg
OKHandle=uicontrol(InputFig , ...
BtnInfo , ...
'Position' ,[ FigWidth-2*BtnWidth-2*DefOffset DefOffset BtnWidth BtnHeight ] , ...
'KeyPressFcn',@doControlKeyPress , ...
'String' ,'OK' , ...
'Callback' ,@doCallback , ...
'Tag' ,'OK' , ...
'UserData' ,'OK' ...
);
setdefaultbutton(InputFig, OKHandle);
CancelHandle=uicontrol(InputFig , ...
BtnInfo , ...
'Position' ,[ FigWidth-BtnWidth-DefOffset DefOffset BtnWidth BtnHeight ] , ...
'KeyPressFcn',@doControlKeyPress , ...
'String' ,xlate('Cancel', '-s') , ...
'Callback' ,@doCallback , ...
'Tag' ,'Cancel' , ...
'UserData' ,'Cancel' ...
); %#ok
Above is code from inputdlg.m.
If you change in inputdlg.m, it will affect all inputdlg usages.
Check other similar functions if they are useful.
dialog, errordlg, helpdlg, listdlg, msgbox,
questdlg, textwrap, uiwait, warndlg

Plus de réponses (0)

Catégories

En savoir plus sur Maintain or Transition figure-Based Apps dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by