Reset button
9 次查看(过去 30 天)
显示 更早的评论
Welcome All...
I have GUI with multiple Edit( To Get User Input ).
I wish to ADD Reset Pushbutton in order to clear All input.
How I can do it ?
0 个评论
采纳的回答
Dr. Seis
2011-12-13
You will have to hard-code this functionality. You will need to create a pushbutton and then under that new pushbutton function you will have to use "set" to restore all your edit boxes back to blank space or a default value. I.e.,
set(handles.my_edit_box,'String','');
or
set(handles.my_edit_box,'String','some_default_value');
2 个评论
Paul Peeling
2011-12-13
If there are a lot of edit boxes, you could set the Tag property on each edit box and use FINDOBJ to change the value of all these controls
Walter Roberson
2011-12-13
Well, findobj to locate the boxes whose String is to be set
set(findobj('Tag','ResetAllowed'),'String',{''})
This will, however, not work if you are using GUIDE, as GUIDE uses the Tag property for other things.
更多回答(2 个)
Paulo Silva
2011-12-13
set(findobj(0,'style','edit'),'string','') %put this in the button callback
%that should clear all edit uicontrols
or
set(findobj(handles.figure1,'style','edit'),'string','')
%should only clear the edit uicontrols from the current GUI
3 个评论
Walter Roberson
2011-12-13
set(findobj(handles.figure1,'style','edit', '-or', 'style','popupmenu'),'string','')
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!