|
Modal 폼은 ModalResult를 반환할 수 있습니다.
Help 를 보시면 예제가 있습니다만, Help의 예저를 그대로 옮겨드리겠습니다.
ModalResult, ShowModal example
------------------------------------------------------------------------------------------------
The following methods are used for buttons in a form that is used as a modal dialog box. The methods cause the dialog box to terminate when the user clicks either the OK or Cancel button, returning mrOk or mrCancel from ShowModal, respectively. You could also set the ModalResult value to mrOk for the OK button and mrCancel for the Cancel button to accomplish the same thing. When the user clicks either button, the dialog box closes.
void __fastcall TOKRightDlg::OKBtnClick(TObject *Sender)
{
ModalResult = mrOk;
}
void __fastcall TOKRightDlg::CancelBtnClick(TObject *Sender)
{
ModalResult = mrCancel;
}
This code brings up the modal dialog from Form1 when a button is clicked. It causes a Beep if the OK button is clicked.
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (OKRightDlg->ShowModal() == mrOk)
MessageBeep(0);
}
이재득 님이 쓰신 글 :
: 안녕하세요
:
: 부모 폼을 AForm 이라 하고 자식 폼을 BForm 이라 할게요
:
: 세부적으로 하지 않을게요.. 이해할 수 있을 정도만 간략히 적을게요.
: AForm::FormCreate 에서
: {
: BForm->ShowModal();
: }
:
: BForm 폼이 떴습니다. BForm 에 '마침' 버튼을 눌렀습니다.
:
: 여기서 질문은 -> BForm 에서 '마침' 버튼을 누른 후 BForm(자식)이 죽고 난 뒤 자연스럽게 AForm 이 죽으려면 어떻게 하는 게 좋습니까?
:
: 간단히 exit(1); 쓰고싶지 않습니다. 좀 깔끔하게 정리하고 싶어서요.
|