Is it possible to set the position of a uialert within app designer?

조회 수: 5 (최근 30일)
Leon
Leon 2020년 2월 11일
댓글: Adam Danz 2025년 6월 16일
Below is my code to generate an alert pop up window.
message = sprintf('No file is generated.');
uialert(app.mainWindow,message,'Warning','Icon','warning');
The problem is that sometimes I need to genereate two such pop up windows for different warning messages on the same app.mainWindow. How do I set them apart from each other?
Thanks.

답변 (1개)

Adam Danz
Adam Danz 2020년 2월 11일
"Is it possible to set the position of a uialert within app designer?"
As of r2019b, no.
Alternatives include using a msgbox(), errordlg(), or warndlg() but this comes with a different set of issues. Unlike uialert(), you'll need to compute the possition of the dialog box so it's on top of your app and you'll also need to set the modal properties in order for it to behave like the uialert(). Note that the Matlab documentation recommends using the uialert() over these other methods for AppDesigner apps.
Another alternative is to reserve a text window within your app designed to provide feedback to the user. In several of my GUIs I have a separate function that receives as input 1) the message, 2) the message type (warning, error, info, etc...). The text area is updated when this function is called and the app behaves differently for each message type. For example, error-types make the font color of the message red.
  댓글 수: 2
Andres Morales
Andres Morales 2025년 6월 4일
Would this still be the case?
Adam Danz
Adam Danz 2025년 6월 16일
As of R2025a, uialert windows do not have the option to set its position.

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

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by