Programming/PowerBuilder
오브젝트의 Parent 찾기[펌]
빅셔
2012. 1. 10. 18:29
1: w_model_window lw_ancestor
2: graphicobject lgo_temp
3: window lw_temp
4: ClassDefinition cdf_child, cdf_ancestor
5:
6: lgo_temp = Parent
7:
8: // 가장 밖에 있는 윈도우 오브젝트를 찾는다.
9: // Tab이 있는 경우 Parent는 Tab이 되므로 상위 윈도를 찾기 위해 루핑
10: DO WHILE lgo_temp.Typeof() <> window!
11: lgo_temp = lgo_temp.GetParent()
12: LOOP
13: lw_temp = lgo_temp
14:
15: // 현재 UserObject가 있는 윈도우의 ClassDefinition 속성을 가져온다.
16: cdf_child = lw_temp.ClassDefinition
17: // 윈도우의 ClassDefinition.Ancestor 속성값이 부모 윈도우의 ClassDefinition.
18: cdf_ancestor = cdf_child.Ancestor
19:
20: // ClassDefinition.Ancestor가 Null이면 상속받은게 아니라 기본 컴포넌트로 만든 것임
21: IF IsNull(cdf_ancestor) THEN
22: Return 0
23: // 부모 윈도우의 ClassDefinition.Name 속성이 부모 윈도우의 이름.
24: ELSEIF cdf_ancestor.Name = 'w_model_window' THEN
25: // 부모윈도우 변수에 Assign
26: lw_ancestor = lw_temp
27: // 여기서 부모 윈도우의 함수를 콜할수 있다.
28: lw_ancestor.wf_부모함수명()