$PBExportHeader$uo_ljfieb_tv_pwr.sru forward global type uo_ljfieb_tv_pwr from treeview end type end forward global type uo_ljfieb_tv_pwr from treeview integer width = 549 integer height = 452 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 16777215 borderstyle borderstyle = stylelowered! boolean disabledragdrop = false boolean hideselection = false boolean tooltips = false boolean checkboxes = true boolean trackselect = true string picturename[] = {"application.ico","graphics\Shell32 005.bmp","graphics\task.bmp","graphics\Shell32 025.ico","graphics\guide.ico","graphics\plan.bmp","graphics\define.bmp","graphics\report.bmp","graphics\system.bmp","graphics\reportfold2.jpg","graphics\Window 08.ico"} long picturemaskcolor = 553648127 long statepicturemaskcolor = 536870912 end type global uo_ljfieb_tv_pwr uo_ljfieb_tv_pwr type variables Long uo_deep = 0 datastore ds_eb s_sys_func_ljfieb uo_cur_info boolean ShowID = false end variables forward prototypes public function integer pf_treegrowth (long arg_handl, long arg_parentid) public function integer f_maketree () public subroutine pf_refresh_value (long arg_handl, string arg_rightstr) public subroutine pf_get_value (long arg_handl, ref string arg_rightstr) public function integer pf_getinfo (long arg_funcid) end prototypes public function integer pf_treegrowth (long arg_handl, long arg_parentid);Int rslt = 1 Long ll_CusareaID,count = 0,ll_i String ls_Cusareaname,ls_areaname Int li_sonflag, li_item s_sys_func_ljfieb ls_s_func[] Long ll_handl TreeViewItem l_tvi uo_deep++ IF uo_deep > 10000 THEN //防止死递归 RETURN 0 END IF String ls_filter ls_filter = 'parentid='+String(arg_parentid) + " and if_use = 1" ds_eb.SetFilter(ls_filter) ds_eb.Filter() ds_eb.SetSort("sortflag") ds_eb.Sort() // FOR ll_i = 1 To ds_eb.RowCount( ) // IF ds_eb.Object.if_use[ll_i] = 0 THEN CONTINUE IF ds_eb.Object.parentid[ll_i] = arg_parentid THEN count++ ls_s_func[count].funcid = ds_eb.Object.funcid[ll_i] ls_s_func[count].treename = ds_eb.Object.treename[ll_i] ls_s_func[count].MenuName = ds_eb.Object.MenuName[ll_i] ls_s_func[count].parentid = ds_eb.Object.parentid[ll_i] ls_s_func[count].sortflag = ds_eb.Object.sortflag[ll_i] ls_s_func[count].functype = ds_eb.Object.functype[ll_i] ls_s_func[count].mainid = ds_eb.Object.mainid[ll_i] ls_s_func[count].if_use = ds_eb.Object.if_use[ll_i] ls_s_func[count].ebtype = ds_eb.Object.ebtype[ll_i] END IF NEXT FOR ll_i = 1 To count // li_item = 2 IF ls_s_func[ll_i].functype = 0 THEN li_item = 2 ELSEIF ls_s_func[ll_i].functype = 9 THEN li_item = 3 END IF ll_handl = This.InsertItemLast(arg_handl,ls_s_func[ll_i].treename,li_item) IF This.GetItem ( ll_handl, l_tvi) = 1 THEN IF ShowID THEN IF ls_s_func[count].mainid > 0 THEN l_tvi.Label = String(ls_s_func[ll_i].funcid) +' - '+ ls_s_func[ll_i].treename + '['+String( ls_s_func[ll_i].mainid)+']' ELSE l_tvi.Label = String(ls_s_func[ll_i].funcid) +' - '+ ls_s_func[ll_i].treename END IF ELSE l_tvi.Label = ls_s_func[ll_i].treename END IF l_tvi.Data = ls_s_func[ll_i].funcid This.SetItem( ll_handl, l_tvi ) END IF pf_treegrowth(ll_handl,ls_s_func[ll_i].funcid) NEXT RETURN 1 end function public function integer f_maketree ();//wf_maketree() Long ll_hand uo_deep = 1 Long tvi_hdl = 0 This.SetRedraw(False) DO UNTIL This.FindItem(RootTreeItem!, 0) = -1 This.DeleteItem(tvi_hdl) LOOP ll_hand = This.InsertItemLast(0,'电子商务',1) //ds_eb.retrieve() pf_treegrowth(ll_hand,0) This.ExpandItem(ll_hand) This.SetRedraw(True) RETURN 0 end function public subroutine pf_refresh_value (long arg_handl, string arg_rightstr);Long ll_handl Long ll_funcid treeviewitem tvi ll_handl = arg_handl ll_handl = this.FindItem(ChildTreeItem!,ll_handl) DO WHILE ll_handl > 0 this.GetItem(ll_handl,tvi) ll_funcid = long(tvi.Data) IF NOT ll_funcid = 0 THEN IF Mid(arg_rightstr,ll_funcid,1) = '0' or Mid(arg_rightstr,ll_funcid,1) = '' THEN tvi.StatePictureIndex = 1 ELSE tvi.StatePictureIndex = 2 END IF END IF this.SetItem(ll_handl,tvi) pf_refresh_value(ll_handl,arg_rightstr) ll_handl = this.FindItem(NextTreeItem!,ll_handl) LOOP end subroutine public subroutine pf_get_value (long arg_handl, ref string arg_rightstr);Long ll_handl Long ll_funcid treeviewitem tvi ll_handl = arg_handl ll_handl = this.FindItem(ChildTreeItem!,ll_handl) DO WHILE ll_handl > 0 this.GetItem(ll_handl,tvi) ll_funcid = long(tvi.Data) IF NOT ll_funcid = 0 THEN if tvi.StatePictureIndex = 2 then arg_rightstr = replace(arg_rightstr,ll_funcid,1, '1') else arg_rightstr = replace(arg_rightstr,ll_funcid,1, '0') end if END IF pf_get_value(ll_handl,arg_rightstr) ll_handl = this.FindItem(NextTreeItem!,ll_handl) LOOP end subroutine public function integer pf_getinfo (long arg_funcid);Int rslt = 1 SELECT funcid, parentid, mainid, functype, treename, menuname, if_use, sortflag, ebtype INTO :uo_cur_info.funcid, :uo_cur_info.parentid, :uo_cur_info.mainid, :uo_cur_info.functype, :uo_cur_info.treename, :uo_cur_info.menuname, :uo_cur_info.if_use, :uo_cur_info.sortflag, :uo_cur_info.ebtype FROM sys_func_pwr_eb Where funcid = :arg_funcid; IF sqlca.SQLCode <> 0 THEN uo_cur_info.funcid = 0 uo_cur_info.parentid = 0 uo_cur_info.mainid = 0 uo_cur_info.functype = 0 uo_cur_info.treename = '' uo_cur_info.menuname = '' uo_cur_info.if_use = 0 uo_cur_info.sortflag = 0 uo_cur_info.ebtype = 0 rslt = 0 GOTO ext END IF // //String ls_parenthandtype //Long ll_parentid // //ll_parentid = uo_cur_info.parentid // //IF uo_cur_info.parentid = 0 THEN // uo_cur_info.parenthandtype = '' //ELSE // SELECT areaname // INTO :ls_parenthandtype // FROM u_Cusarea // Where Cusareaid = :ll_parentid; // IF sqlca.SQLCode <> 0 THEN // uo_cur_info.parenthandtype = '' // ELSE // uo_cur_info.parenthandtype = ls_parenthandtype // END IF //END IF ext: RETURN rslt // // end function on uo_ljfieb_tv_pwr.create end on on uo_ljfieb_tv_pwr.destroy end on event constructor;ds_eb = CREATE datastore ds_eb.DataObject = 'ds_func_pwr_eb' ds_eb.SetTransObject(sqlca) f_maketree() end event event selectionchanged;Long ll_hand Long ll_funcid TreeViewItem l_tvi ll_hand = THIS.FindItem(CurrentTreeItem!,0) IF THIS.GetItem(ll_hand,l_tvi) = 1 THEN IF ll_hand = 1 THEN ll_funcid = 0 ELSE ll_funcid = l_tvi.Data END IF pf_getinfo(ll_funcid) THIS.ExpandItem(ll_hand) END IF end event event destructor;DESTROY ds_eb end event