Dialog vs MessageBox — 언제 어느 걸 쓰나 #shorts #SAP #UI5

Moderator · 조회 3

MessageBox — 확인·알림에 쓴다

단순 확인, 경고, 에러 팝업처럼 버튼 1~2개만 쓰는 경우엔 MessageBox가 적합합니다. 한 줄로 끝납니다.

MessageBox.confirm("저장할까요?", {
  onClose: (sAction) => {
    if (sAction === MessageBox.Action.OK) {
      this._save();
    }
  }
});

Dialog — 복잡한 UI가 필요할 때

폼 입력, 테이블, 커스텀 콘텐츠처럼 여러 컨트롤이 필요한 팝업엔 Dialog를 씁니다. Fragment로 분리하면 재사용이 편합니다.

new Dialog({
  title: "상세 입력",
  content: [ oForm ],
  buttons: [
    new Button({
      text: "확인",
      type: "Emphasized",
      press: () => oDialog.close()
    })
  ]
}).open();

선택 기준 한눈에

버튼만 있는 확인·경고 → MessageBox. 폼·테이블 등 컨트롤 포함 → Dialog.

핵심 한 줄

단순 확인엔 MessageBox.confirm(), 커스텀 UI엔 new Dialog() — Fragment로 감싸면 재사용까지 된다.