windowname.ParentWindow()
Description
Obtains the parent window of a window.
Controls
Window objects
Syntax
windowname.ParentWindow()
Argument | Description |
windowname | The name of a window for which you want to obtain the parentobject |
Return value
Window. Returns the parent of windowname. Returns a null object reference if an error occurs or if windowname is null.
Usage
The ParentWindow function, along with the pronoun Parent, allows you to write more general scripts by avoiding the coding of actual window names. Parent refers to the window that contains the current object or control - the local environment. ParentWindow returns the parent window of a specified window.
Whether a window has a parent depends on its type and how it was opened. You can specify the parent when you open the window. For windows that always have parents, PowerBuilder chooses the parent if you do not specify it. Response windows and child windows always have a parent window. The parent of a sheet in an MDI application is the MDI frame window. Pop-up windows have a parent window when they are opened from another window but when used in an MDI application, the parent of the pop-up is the MDI frame. A pop-up window opened from the application's Open event does not have a parent.
The ParentWindow property of the Menu object can be used like a pronoun in Menu scripts. It identifies the window with which the menu is associated when your program is running. For more information, see the PowerBuilder User's Guide.
이 함수는 윈도우 콘트롤에서만 쓸 수 있다.
ParentWindow함수는 Parent 키워드와 함께 실질 적인 윈도 이름을 쓰는 것을 피하고 보다 범용적인 코딩을 할 수 있게 한다.
Parent 는 객체(Object)나 콘트롤(Control)을 담고 있는 윈도를 참조 할 수 있다.
ParentWindow는 지정된 윈도우의 부모 윈도를 돌려 준다.
윈도가 부모를 가질 지 말지는 그 윈도우의 타입 혹은 윈도우가 어떻게 열렸는지에 달렸다.
윈도우를 열적에 부모 윈도우를 기술 할 수 있다.
항상 부모 윈도우를 가져야 하는 윈도우들의 경우, 우리가 부모 윈도우를 알려 주지 않으면, 파워빌더가 부모 윈도우를 선택 한다. Response windows와 child windows는 항상 부모 윈도우를 갖는다. MDI application에서 쓰이는 Sheet의 부모는 MDI Frame Window이다.
Pop-up Window는 다른 window에 의 해 열렸을 경우, 부모 윈도우를 갖는다. 단, MDI application이라면 Pop-up의 부모는 MDI Frame이다.
또한, application의 Open Event에서 열린 Pop-up window의 경우는 부모 윈도우를 갖지 않는다.
Menu Object에서는 ParentWindow가 명사 처럼 사용 될 수 있다.
이 경우 실행 단계에서의 메뉴와 관계 있는 윈도우를 구분 한다.
** Response와 child 형 윈도우는 항상 부모 윈도우를 갖는다 하였는데.. 내가 해 본 바에 의하면 child는 MDI에서 sheet상에서 열렸을 경우, 부모 윈도우로 해당 sheet를 돌려 준다. 하지만 response윈도우는 MDI Frame를 돌려 준다. 버그 인가? 설명이 잘못 된 것인가? 아뭏든 그렇다.
내가 당면한 문제는 윈도우 타입을 child로 놓고 화면을 OpenWithParm으로 띄우니, single line edit가 마우스로 찍어서는 입력이 되지 않는 다는 것이다. 그래서 Response 타입으로 놓으니, 부모 윈도우에서 가져 오는 것을 가져 오지 못하여 오류가 발생 한다.
위의 문제 점으로 ParentWindow()를 쓰면 MDI Frame을 돌려 주므로 여기에 GetActiveSheet()까지 써서 해당 부모 윈도우 타입의 변수에 할당(cast)하여 처리 하였다.
sle에 입력도 잘 되고 부모 윈도우에서 데이타도 잘 가져 온다.
No comments:
Post a Comment