3

I was wondering if there is a way to prevent an error dialog (errordlg) to appear when an existing error dialog hasn't been attended yet. I'm developing a GUI in matlab and I can easily make 50 error dialogs to appear and collapse my task manager as it is shown in the picture.

A lot of error dialogs

On the other hand, I have seen warning or error dialogs that don't let the user to operate the GUI until he attends them. Is there anyway to do that?

Thanks in advance! Charlie

1

2 Answers 2

4

If the same callback is creating the error dialog, you can prevent callback re-entrancy by inspecting dbstack for multiple calls to the responsible callback. See the isMultipleCall function on this blog.

There is no sense to plagiarizing Yair Altman's function here, but the usage would involve putting the following line at the top of the callback that creates the errordialog:

if isMultipleCall();  return;  end

Then that callback cannot run again until you have addressed the errordialog, allowing the first call to terminate.

However, you can create your error dialog with the 'WindowStyle' called 'modal', which will prevent interaction with any other MATLAB window until the dialog is closed.

Sign up to request clarification or add additional context in comments.

1 Comment

'modal' in my opinion is the proper way to go. An error-dialog should be taken care of before anything further happens...
3

errordlg has a third argument createmode. One possible value is 'replace' for which all previously open error dialogs with the same title are closed. This can be useful in your case if the 50 or so error dialogs are the same.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.