A static text does not update after set() until the callback has finished

2 ビュー (過去 30 日間)
Iker Ocio
Iker Ocio 2018 年 1 月 24 日
回答済み: Jordy Jose 2018 年 1 月 31 日
I am developing an interface.
In each loading time, I have a status information to notify the user when the information is ready.
function acceptButton_Callback(hObject, eventdata, handles)
set(handles.statusTag,'String','Status: Loading...');
% More code to retrieve values from another handles elements
% This function lasts to return a value from 5-10 seconds
output = UserRequirements(filepath, index_selected, timeValue, softnessValue, geoErrorValue);
% Here I fill a listbox with output and lasts from 5 to 10 seconds
set(handles.statusTag, 'String', 'Status: Ok');
guidata(hObject, handles);
The normal funcionality is to see how that text change from Status: Ok to Status: Loading... and after 5-10 seconds, change from Status: Loading... to Status: Ok.
Well, if I run this code in debug mode, I can see the change. If not, seems that the text changing happen after all code execution has finished.
I have done the same in another function and everything works ok, but here not.
Any suggestions?

回答 (1 件)

Jordy Jose
Jordy Jose 2018 年 1 月 31 日
Hi,
It looks like the call to change the status text is taking time to update the graphics. You may want to use the function "drawnow" to resolve this issue. For more details regarding "drawnow" function, please refer to the link below:
https://www.mathworks.com/help/matlab/ref/drawnow.html

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by