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

조회 수: 2 (최근 30일)
Hannah
Hannah 2013년 4월 18일
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