Main Content

대화 상자 업데이트하기

uialertuiconfirm과 같은 함수를 사용하여 uifigure 기반 앱에 대화 상자를 추가합니다. 이러한 대화 상자 함수는 앱에서 사용할 수 있도록 특별히 구성되었습니다. errordlgquestdlg와 같은 함수를 사용하여 대화 상자를 만드는 것은 계속 지원됩니다. 그러나 앱 작성과 관련된 대화 상자를 사용하면 이점이 있습니다. 이러한 대화 상자에는 다음을 비롯한 추가 사용자 지정 옵션이 있습니다.

  • 사용자 지정 아이콘을 지정하는 기능

  • HTML 또는 LaTeX 마크업을 사용하여 텍스트 형식을 지정하는 기능

  • 대화 상자가 닫힐 때 실행되는 콜백을 작성하는 기능

또한 이러한 대화 상자는 앱을 구성하는 UI Figure 창 내에 표시됩니다.

Alert dialog box in a UI figure window. The app is visible behind the dialog box.

이러한 이점을 활용하려면 uifigure 함수를 사용하도록 figure 기반 앱을 전환할 때, 앱의 대화 상자를 만들기 위해 호출하는 함수를 업데이트하십시오. 다음 표에는 figure 기반 앱에서 대화 상자를 만드는 데 사용할 수 있는 함수와 uifigure 기반 앱에 대해 구성된 이에 상응하는 함수가 나열되어 있습니다.

figure 기반 앱uifigure 기반 앱
함수함수
errordlg
errordlg("Operation unsuccessful","Error");

figure-based error dialog box

uialert
fig = uifigure;
uialert(fig,"Operation unsuccessful","Error")

uifigure-based error dialog box

warndlg
warndlg("This operation cannot be undone","Warning");

figure-based warning dialog box

uialert
fig = uifigure;
uialert(fig,"This operation cannot be undone","Warning", ...
    "Icon","warning")

uifigure-based warning dialog box

msgbox
msgbox("Operation completed","Done","modal");

figure-based message dialog box

uialert
fig = uifigure;
uialert(fig,"Operation completed","Done", ...
    "Icon","none")

uifigure-based message dialog box

helpdlg
helpdlg("Consider using a cell array","Data Types");

figure-based help dialog box

uialert
fig = uifigure;
uialert(fig,"Consider using a cell array","Data Types", ...
    "Icon","info")

uifigure-based help dialog box

questdlg
questdlg("Do you want to continue?","Confirm");

figure-based question dialog box

uiconfirm
fig = uifigure;
uiconfirm(fig,"Do you want to continue?","Confirm", ...
    "Options",["Yes" "No" "Cancel"])

uifigure-based question dialog box

waitbar
waitbar(0.3,"Loading...","Name","Please Wait");

figure-based progress dialog box

uiprogressdlg
fig = uifigure;
uiprogressdlg(fig,"Value",0.3, ...
    "Message","Loading...", ...
    "Title","Please Wait");

uifigure-based progress dialog box

관련 항목