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

2 views (last 30 days)
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

Accepted Answer

Hannah
Hannah on 19 Apr 2013
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.

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!