Uninterruptible GUI Callback without User Input

I made a GUI with GUIDE which, when a button is pressed, triggers an interruptible callback (named C1) that runs a while loop until an exit condition is met. In the while loop, there is a section of code that once started must run to completion without interruption. If the callback is interrupted while executing this code, the interrupting callback must be executed after the code has finished.
I've tried using the waitfor function but it doesn't work as needed in the case of callbacks. I've also tried making an uninterruptible callback (named C2) run the important code and calling that C2 from within the while loop of C1, but it seems C2 is still interruptible unless triggered by a click event on its button from the user.
Is there a way to make a function or section of code uninterruptible and triggered by code as opposed to user input?

답변 (1개)

Walter Roberson
Walter Roberson 2018년 2월 7일

0 개 추천

You can set the uicontrol Interruptible property to 'off' and 'BusyAction' to 'queue'
Or, you can set all buttons to 'Enable', 'disable' while running the critical routine.
Instead of having to know about all other buttons to change their Enable properties, you can also put the critical button inside a figure whose 'WindowStyle' is set to 'modal' (and set that one object to Interruptible off or set that one button Enable 'disable' during the critical action.)

댓글 수: 1

I tried and saw that Interruptible and Busyaction do help when you use buttons.
The uicontrol do not help when it comes to something like a cellEdit of a table. While editing a cell, if you triger another function like cellselection of another table, it simply switches the flow to the trigerred function without completing the celledit first.
Do you have any suggestion?
Not sure if this is legal here but I here is a link to the detail of my question.
https://de.mathworks.com/matlabcentral/answers/1630540-complete-executing-celledit-before-any-other-function-is-trigerred

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

질문:

2018년 2월 7일

댓글:

2022년 1월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by