C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[45942] Re:자식이 부모를 죽이는 방법?
ayh [] 1620 읽음    2006-07-31 22:33
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); 쓰고싶지 않습니다. 좀 깔끔하게 정리하고 싶어서요.

+ -

관련 글 리스트
45938 자식이 부모를 죽이는 방법? 이재득 1716 2006/07/31
45942     Re:자식이 부모를 죽이는 방법? ayh 1620 2006/07/31
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.