Updating Values in a GUI from Editable Text Boxes
1 次查看(过去 30 天)
显示 更早的评论
I wrote a GUI that performs tracking operations on a video and has a pause/start button but my problem is I'd like to make it be able to change the tracking parameters when it is paused. The tracking itself happens in a while loop but I've been able to interrupt the while loop when I press the pause button.
I've tried to update variables in the past using get() as in:
if true
maxCount=str2double(get(handles.edit6,'String')); %(no need to call guidata here)
end
ot alternatively through use of the handles structure but nothing seems to work and the tracking script seems to just use the first set of variables fed into the edit boxes.
This is currently the code for my Pause/Play button. Is there some way I could modify it to update the tracking parameters contained in the editable text boxes on my GUI. Any help in resolving this matter would be greatly appreciated.:
% % ************************ PAUSE / PLAY ***********************************
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if(strcmp(get(handles.pushbutton3,'String'),'Pause'))
set(handles.pushbutton3,'String','Play');
set(handles.pushbutton4,'Enable','on');
set(handles.pushbutton5,'Enable','on');
uiwait();
else
set(handles.pushbutton3,'String','Pause');
set(handles.pushbutton4,'Enable','on');
set(handles.pushbutton5,'Enable','off');
uiresume();
end
0 个评论
采纳的回答
Nanda Gupta
2017-3-28
What I understand from the above description is that when you push a play/pause button, the values contained in the editable text boxes are not updating.
I can see that the GUI data is not getting updated once the handles are set. You can do so by using the "guidata" function. So right after setting the handles, just pass the handles and hObject to this function:
set(handles.pushbutton5,'Enable','on');
guidata(hObject, handles);
For more information regarding "guidata", please refer: https://www.mathworks.com/help/matlab/ref/guidata.html
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!