function fig_hdl = BusyActionTest_build
handles = struct();
build_gui();
fig_hdl = handles.figure1;
function build_gui()
handles.figure1 = figure( ...
'Tag', 'figure1', ...
'Units', 'characters', ...
'Position', [103.8 46.1538461538462 90.2 15.4615384615385], ...
'Name', 'BusyActionTest', ...
'MenuBar', 'none', ...
'NumberTitle', 'off', ...
'Color', get(0,'DefaultUicontrolBackgroundColor'), ...
'Interruptible', 'off', 'BusyAction', 'cancel');
handles.uipanel2 = uibuttongroup( ...
'Parent', handles.figure1, ...
'Tag', 'uipanel2', ...
'UserData', zeros(1,0), ...
'Units', 'characters', ...
'Position', [3.8 1.46153846153846 50.2 12.3846153846154], ...
'Title', {'Button Group'}, ...
'SelectionChangeFcn', @uipanel2_SelectionChangeFcn, ...
'Interruptible', 'off', 'BusyAction', 'cancel');
handles.text3 = uicontrol( ...
'Parent', handles.uipanel2, ...
'Tag', 'text3', ...
'Style', 'text', ...
'Units', 'characters', ...
'Position', [7.8 1.46153846153845 36.2 1.61538461538462], ...
'String', '-');
handles.pushbutton1 = uicontrol( ...
'Parent', handles.figure1, ...
'Tag', 'pushbutton1', ...
'Style', 'pushbutton', ...
'Units', 'characters', ...
'Position', [59.8 10.6923076923077 26.2 2.38461538461538], ...
'String', {'Push Button'}, ...
'Callback', @pushbutton1_Callback, ...
'Interruptible', 'off', 'BusyAction', 'cancel');
handles.radiobutton5 = uicontrol( ...
'Parent', handles.uipanel2, ...
'Tag', 'radiobutton5', ...
'Style', 'radiobutton', ...
'Units', 'characters', ...
'Position', [5.8 7.46153846153848 17.4 1.76923076923077], ...
'String', {'Radio Button'}, ...
'Interruptible', 'off', 'BusyAction', 'cancel');
handles.radiobutton6 = uicontrol( ...
'Parent', handles.uipanel2, ...
'Tag', 'radiobutton6', ...
'Style', 'radiobutton', ...
'Units', 'characters', ...
'Position', [5.8 4.3846153846154 17.4 1.76923076923077], ...
'String', {'Radio Button'}, ...
'Interruptible', 'off', 'BusyAction', 'cancel');
end
function uipanel2_SelectionChangeFcn(hObject,evendata)
DoStuff(handles);
end
function pushbutton1_Callback(hObject,evendata)
set(handles.text3, 'String', 'The button was pushed!');
end
function DoStuff(handles)
set(handles.figure1, 'Pointer', 'watch');
drawnow;
for n = 1:5
set(handles.text3, 'String', ['Counting to 5: ', num2str(n, '%d')]);
pause(1);
end
set(handles.text3, 'String', '-');
set(handles.figure1, 'Pointer', 'arrow');
end
end
3 Comments
Jan (view profile)
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/44183-busyaction-cancel-not-working#comment_90866
Marc Lalancette (view profile)
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/44183-busyaction-cancel-not-working#comment_91152
Jan (view profile)
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/44183-busyaction-cancel-not-working#comment_91185
Sign in to comment.