How do I automatically update the text in an edit box?

2 次查看(过去 30 天)
So i have a variable totalMax that updates every time a check box is checked. There are 9 check boxes, and each update the table in certain ways, which then updates totalMax. (this happens in a seperate function I wrote, and each checkbox call back function executes it).
Currently I print totalMax into a string using sprintf and then save it into an GUI object = using this function:
function handleNewMax(handles, new_max)
handles.maxCap = new_max;
guidata(handles.output, handles);
And in the edit box call back function i do this:
handles = guidata(handles.output);
set (hObject, 'String', handles.maxCap);
It works out fine and everything. BUT it only will update if i press enter in the box. Is there a way to have the text box automatically update, specifically if I update totalMax? (or teh string i put it in)?
Thanks

采纳的回答

Hannah
Hannah 2013-4-19
OH i just realized, it is simpler that i thought it was. So i have been looking for solutions to this problem and it seemed so simple just put 'set(handles.edit3, 'String', Maxcfs_str)' but there were issues. But I put this in a function I wrote,and there were issues accessing handles.edit3. BUT if I pass in hObject, eventdata, and handles, into the custom functio i wrote, the set function works fine.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by