MATLAB Answers

My modal dialog box does not prevent interactions with a MATLAB app (made by App Designer) window

25 views (last 30 days)
CreLox
CreLox on 25 Jun 2019
Edited: CreLox on 25 Jun 2019
I have a custom app designed in App Designer, which is composed of one input box (accepting data) and a confirm button. Pushing the confirm button will execute a callback function, which will check whether the box is empty first:
function ConfirmButtonPushed(app, event)
if isempty(app.Databox.Value)
errordlg('No data supplied.', 'Input Error', 'modal');
return;
else
% Some actions to process the data
end
end
If the box is empty, the user is supposed to acknowledge the error message before going back to interact with the app again. However, the modal error dialog does not prevent interactions with the app window (It does prevent interactions with the main MATLAB command line window). Any clue?

  0 Comments

Sign in to comment.

Accepted Answer

Geoff Hayes
Geoff Hayes on 25 Jun 2019
CreLox - try using uialert instead. This may work assuming that your app has been created with the uifigure function.

  1 Comment

CreLox
CreLox on 25 Jun 2019
It worked. Thank you! The only issue with this workaround is that a uialert dialog window is nested inside the app window and seems to have a minimal width and height, which may not fit into the app window.

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Products


Release

R2019a