[ 파워빌더.DataWindow - Type 알아내기  ]

 

☞   

 

DW의 Type에 대하여 문의 하신 분이 있었는데

오늘 잠깐 보다보니 예전에 이런 소스를 만들어서 사용했더군요

해서 참고 하세요

우선 nonvisualobject를 만드세요(있으면 그냥 넣으세요)

------- 이렇게 함수 하나 만드세요 ---------

/* String GetDWType ( powerobject apo_obj )
*/
String ls_DWtype, ls_syntax
datawindow ldw
datastore lds
datawindowchild ldwc

ls_syntax = ''
if IsValid( apo_obj ) then
 choose case apo_obj.TypeOf()
  case datawindow!
   ldw = apo_obj
   ls_syntax = ldw.Describe("DataWindow.Syntax")
  case datastore!
   lds = apo_obj
   ls_syntax = lds.Describe("DataWindow.Syntax")
  case datawindowchild!
   ldwc = apo_obj
   ls_syntax = ldwc.Describe("DataWindow.Syntax")
 end choose
end if
if Trim(ls_syntax) = '' or IsNull(ls_syntax) then
 ls_DWtype = 'Not Object ...'
else
 ls_DWtype = GetDWType( ls_syntax )
end if

return ls_DWtype

-------- 다음과 같이 중복으로 하나더 만드세요 ------

/* String GetDWType ( string as_syntax )
*/
string s_DWType
integer i_rtn = 0
DataStore lds
lds = create DataStore
lds.create( as_syntax, s_DWType )
if Len(s_DWType) = 0 then
 choose case lds.Describe("DataWindow.Processing")
  case '0'
   if Pos(as_syntax,'report') > 0 then
    /* 하위에 report가 있으면 composite */
    s_DWType = 'composite'
   else
    if long(lds.Describe("DataWindow.Header.Height")) = 0 then
     /* Header Height 가 0 이면 */
     s_DWType = 'freefrom'
    else
     //if long(lds.Describe("DataWindow.Rows_Per_Detail")) > 0 then rows_per_detail
     if Pos(as_syntax,'rows_per_detail') > 0 then
      /* 단수가 있으면 n-up */
      s_DWType = 'n-up'
     else
      //if Pos(Lower(as_syntax), 'group') > 0 then
       /* group 이 있으면 group */
      // s_DWType = 'group'
      //else
       s_DWType = 'tabular'
      //end if
     end if
    end if
   end if
  case '1'
   s_DWType = 'grid'
  case '2'
   s_DWType = 'label'
  case '3'
   s_DWType = 'graph'
  case '4'
   s_DWType = 'crosstab'
  case '5'
   s_DWType = 'composite'
  case '6'
   s_DWType = 'ole20'
  case '7'
   s_DWType = 'richtext'
  case '8'
   s_DWType = 'treeview'
 end choose
end if
return s_DWType
/*
 
 choose case in_df.GetDWType(ls_syntax)
  case 'composite'
  case 'crosstab'
  case 'freefrom'
  case 'graph'
  case 'grid'
  case 'group'
  case 'label'
  case 'n-up'
  case 'ole20'
  case 'richtext'
  case 'tabular'
  case 'treeview'
 end choose

*/

 

Posted by 농부지기
,