How to reset the static text box each time i press the run button
Show older comments
Hey so I have a static text box that after my code has run (after I push the run button) displays "DONE". I want the displayed message to revert back to "-" after I press the run button again so that it is clear when the code is done running. I've been using
pause(4)
then
set(handles.editbox1,'string','-');
to reset it after 4 seconds, but this is not helpful if you leave come back and the result is still the same (i.e. can't tell that it ran).
Answers (2)
Azzi Abdelmalek
on 29 Aug 2013
0 votes
Where did you put those 3 lines of code? Maybe they are in the static text callback which is wrong
3 Comments
Alex
on 29 Aug 2013
Azzi Abdelmalek
on 29 Aug 2013
What do you mean by: if you leave come back
Alex
on 29 Aug 2013
Image Analyst
on 29 Aug 2013
0 votes
Then the only way is to either leave it as "Done", or put up a messagebox to tell the user, because your program that set the label to "Done" and then sets it to "-" 4 seconds later can't possibly know when your user returns to the computer. With either of those ways, the user will know your code has finished. They might also surmise that it's finished if you set it to "-" if, when it's running, you have the info text label say "processing...." while it's running or put up a progress bar. If they don't see "processing..." or the progress bar, and instead see the "-" or "Done" or message box, then they'll figure that it's done. Anything wrong with that?
3 Comments
Alex
on 29 Aug 2013
Alex
on 29 Aug 2013
Image Analyst
on 29 Aug 2013
Sometimes it gets into a function so intensive that the message to update the label doesn't get executed until much later. Try putting a "drawnow" after every call to set(). That should force the update to happen, so that when you press the button again it will show the "processing" string.
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!