123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707 |
- $PBExportHeader$w_system_window_ch.srw
- forward
- global type w_system_window_ch from window
- end type
- type cb_refresh from uo_imflatbutton within w_system_window_ch
- end type
- type cb_ch from uo_imflatbutton within w_system_window_ch
- end type
- type tv_func from treeview within w_system_window_ch
- end type
- type cb_exit from uo_imflatbutton within w_system_window_ch
- end type
- type r_bar from rectangle within w_system_window_ch
- end type
- type ln_bar from line within w_system_window_ch
- end type
- type ln_bar2 from line within w_system_window_ch
- end type
- end forward
- global type w_system_window_ch from window
- integer x = 5
- integer y = 4
- integer width = 3611
- integer height = 2480
- boolean titlebar = true
- string title = "系统窗口选择"
- boolean controlmenu = true
- windowtype windowtype = response!
- long backcolor = 80269524
- boolean center = true
- cb_refresh cb_refresh
- cb_ch cb_ch
- tv_func tv_func
- cb_exit cb_exit
- r_bar r_bar
- ln_bar ln_bar
- ln_bar2 ln_bar2
- end type
- global w_system_window_ch w_system_window_ch
- type prototypes
- subroutine keybd_event(uint bVk,uint bScan,long dwFlags,long dwExtraInfo ) library 'user32.dll'
- end prototypes
- type variables
- long deep=0,il_handle
- long cur_mainid
- end variables
- forward prototypes
- public function string wf_getright ()
- public function integer wf_build_functree ()
- public function integer pf_treegrowth (long arg_handl, long arg_funcid, integer arg_lp)
- public subroutine wf_refresh_tvchild (long arg_handl, string arg_rightstr)
- public subroutine wf_refresh_tvnext (long arg_handl, string arg_rightstr)
- public subroutine wf_getright_tvchild (long arg_handl, ref string arg_rightstr)
- public subroutine wf_getright_tvnext (long arg_handl, ref string arg_rightstr)
- public subroutine wf_set_tvparent (long arg_handl)
- public subroutine wf_set_tvchild (long arg_handl)
- public subroutine wf_refresh ()
- public subroutine wf_clear_tvchild (long arg_handl, integer arg_statepictureindex)
- public subroutine wf_clear_tvnext (long arg_handl, integer arg_statepictureindex)
- public subroutine wf_set_tvnext (long arg_handl)
- end prototypes
- public function string wf_getright ();string ls_ret
- ls_ret=fill("0",2000)
- long ll_handl
- ll_handl = tv_func.finditem(RootTreeItem!,0)
- if ll_handl > 0 then wf_getright_tvchild(ll_handl,ls_ret)
- return ls_ret
- end function
- public function integer wf_build_functree ();//====================================================================
- // Function: wf_build_functree()
- //--------------------------------------------------------------------
- // Description:
- //--------------------------------------------------------------------
- // Arguments:(None)
- //--------------------------------------------------------------------
- // Returns: integer
- //--------------------------------------------------------------------
- // Author: yyx Date: 2004.11.16
- //--------------------------------------------------------------------
- // Modify History:
- //
- //====================================================================
- long hand
- deep=1
- long tvi_hdl = 0
- do until tv_func.finditem(roottreeitem!, 0) = -1
- tv_func.deleteitem(tvi_hdl)
- loop
- hand=tv_func.insertitemlast(0,sys_message_title,1)
- pf_treegrowth(hand,0,2)
- tv_func.expanditem(hand)
- return 1
- end function
- public function integer pf_treegrowth (long arg_handl, long arg_funcid, integer arg_lp);//====================================================================
- // function: pf_treegrowth()
- //--------------------------------------------------------------------
- // description:
- //--------------------------------------------------------------------
- // arguments:
- // value long arg_handl
- // value long arg_funcid
- // value integer arg_lp
- //--------------------------------------------------------------------
- // returns: integer
- //--------------------------------------------------------------------
- // author: yyx date: 2004.11.16
- //--------------------------------------------------------------------
- // modify history:
- //
- //====================================================================
- int rslt = 1
- s_sys_func ls_s_func[]
- long count = 0,ls_i
- long handl
- treeviewitem tvi
- deep++
- if deep > 100000 then //防止死递归
- return 0
- end if
- string ls_filter
- ls_filter = 'parentid='+string(arg_funcid)
- sys_ds_maininfo.setfilter(ls_filter)
- sys_ds_maininfo.filter()
- for ls_i = 1 to sys_ds_maininfo.rowcount( )
- if sys_ds_maininfo.object.functype[ls_i] >= 9 then continue
- if sys_ds_maininfo.object.if_use[ls_i] = 0 then continue
- if sys_ds_maininfo.object.parentid[ls_i] = arg_funcid then
- if sys_ds_maininfo.object.funcid[ls_i] = 262 then continue //系统维护除外
-
- count++
- ls_s_func[count].funcid = sys_ds_maininfo.object.funcid[ls_i]
- ls_s_func[count].treename = sys_ds_maininfo.object.treename[ls_i]
- ls_s_func[count].menuname = sys_ds_maininfo.object.menuname[ls_i]
- ls_s_func[count].parentid = sys_ds_maininfo.object.parentid[ls_i]
- ls_s_func[count].sortflag = sys_ds_maininfo.object.sortflag[ls_i]
- ls_s_func[count].functype = sys_ds_maininfo.object.functype[ls_i]
- ls_s_func[count].mainid = sys_ds_maininfo.object.mainid[ls_i]
- ls_s_func[count].if_use = sys_ds_maininfo.object.if_use[ls_i]
- ls_s_func[count].versiontype = sys_ds_maininfo.object.versiontype[ls_i]
- ls_s_func[count].worktype = sys_ds_maininfo.object.worktype[ls_i]
- end if
- next
- string ls_item
- for ls_i = 1 to count
- ls_item = ls_s_func[ls_i].treename
-
- handl = tv_func.insertitemlast(arg_handl,ls_item,arg_lp) //生成树
- // tv_func.expanditem(arg_handl)
- tv_func.getitem(handl,tvi)
- tvi.statepictureindex = 2
- tvi.data = ls_s_func[ls_i]
- tv_func.setitem(handl,tvi)
-
- pf_treegrowth(handl,ls_s_func[ls_i].funcid,arg_lp+1) //下级生成树
- next
- return rslt
- end function
- public subroutine wf_refresh_tvchild (long arg_handl, string arg_rightstr);long ll_handl
- long ll_funcid
- treeviewitem tvi
- ll_handl = arg_handl
- ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl)
- do while ll_handl > 0
- tv_func.getitem(ll_handl,tvi)
- ll_funcid = tvi.data
- // messagebox("0",ll_funcid)
- if not ll_funcid = 0 then
- if mid(arg_rightstr,ll_funcid,1)='0' then
- tvi.statepictureindex = 1
- else
- tvi.statepictureindex = 2
- end if
- end if
- tv_func.setitem(ll_handl,tvi)
-
- wf_refresh_tvnext(ll_handl,arg_rightstr)
- ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl)
- loop
- end subroutine
- public subroutine wf_refresh_tvnext (long arg_handl, string arg_rightstr);long ll_handl
- long ll_funcid
- treeviewitem tvi
- ll_handl = arg_handl
- ll_handl = tv_func.finditem(NextTreeItem!,ll_handl)
- do while ll_handl > 0
- tv_func.getitem(ll_handl,tvi)
- ll_funcid = tvi.data
- // messagebox("1",ll_funcid)
- if not ll_funcid = 0 then
- if mid(arg_rightstr,ll_funcid,1)='0' then
- tvi.statepictureindex = 1
- else
- tvi.statepictureindex = 2
- end if
- end if
- tv_func.setitem(ll_handl,tvi)
-
- wf_refresh_tvchild(ll_handl,arg_rightstr)
- ll_handl = tv_func.finditem(NextTreeItem!,ll_handl)
- loop
- end subroutine
- public subroutine wf_getright_tvchild (long arg_handl, ref string arg_rightstr);long ll_handl
- long ll_funcid
- treeviewitem tvi
- ll_handl = arg_handl
- ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl)
- do while ll_handl > 0
- tv_func.getitem(ll_handl,tvi)
- ll_funcid = tvi.data
- // messagebox("0",ll_funcid)
- if not ll_funcid = 0 then
- if tvi.statepictureindex = 2 then
- arg_rightstr=replace(arg_rightstr,ll_funcid,1,"1")
- end if
- end if
-
- wf_getright_tvnext(ll_handl,arg_rightstr)
- ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl)
- loop
- end subroutine
- public subroutine wf_getright_tvnext (long arg_handl, ref string arg_rightstr);long ll_handl
- long ll_funcid
- treeviewitem tvi
- ll_handl = arg_handl
- ll_handl = tv_func.finditem(NextTreeItem!,ll_handl)
- do while ll_handl > 0
- tv_func.getitem(ll_handl,tvi)
- ll_funcid = tvi.data
- // messagebox("1",ll_funcid)
- if not ll_funcid = 0 then
- if tvi.statepictureindex = 2 then
- arg_rightstr=replace(arg_rightstr,ll_funcid,1,"1")
- end if
- end if
- tv_func.setitem(ll_handl,tvi)
-
- wf_getright_tvchild(ll_handl,arg_rightstr)
- ll_handl = tv_func.finditem(NextTreeItem!,ll_handl)
- loop
- end subroutine
- public subroutine wf_set_tvparent (long arg_handl);//====================================================================
- // Function: wf_find_parenttree()
- //--------------------------------------------------------------------
- // Description:
- //--------------------------------------------------------------------
- // Arguments:
- // value long arg_handl
- // value long arg_state
- //--------------------------------------------------------------------
- // Returns: (none)
- //--------------------------------------------------------------------
- // Author: yyx Date: 2004.11.18
- //--------------------------------------------------------------------
- // Modify History:
- //
- //====================================================================
- long ll_handl
- treeviewitem tvi
- ll_handl = arg_handl
- tv_func.getitem(ll_handl,tvi)
- tvi.StatePictureIndex = 2
- tv_func.setitem(ll_handl,tvi)
- ll_handl = tv_func.finditem(ParentTreeItem!,ll_handl)
- do while ll_handl > 0
- tv_func.getitem(ll_handl,tvi)
- tvi.StatePictureIndex = 2
- tv_func.setitem(ll_handl,tvi)
- ll_handl = tv_func.finditem(ParentTreeItem!,ll_handl)
- loop
- end subroutine
- public subroutine wf_set_tvchild (long arg_handl);//====================================================================
- // Function: wf_find_childtree()
- //--------------------------------------------------------------------
- // Description:
- //--------------------------------------------------------------------
- // Arguments:
- // value long arg_handl
- // value long arg_state
- //--------------------------------------------------------------------
- // Returns: integer
- //--------------------------------------------------------------------
- // Author: yyx Date: 2004.11.18
- //--------------------------------------------------------------------
- // Modify History:
- //
- //====================================================================
- long ll_handl
- treeviewitem tvi
- ll_handl = arg_handl
- tv_func.getitem(ll_handl,tvi)
- tvi.StatePictureIndex = 1
- tv_func.setitem(ll_handl,tvi)
- ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl)
- do while ll_handl > 0
- wf_set_tvnext(ll_handl)
- ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl)
- loop
- end subroutine
- public subroutine wf_refresh ();//wf_refresh
- //long ll_row
- //long ll_storageid,ll_scid
- //long i,li_no,cnt
- //string ls_str,ls_storage_str,ls_scstr
- //
- //ll_row = dw_1.getrow()
- //
- //if ll_row > 0 then
- // if is_id = sys_super_id then
- // ls_str = fill('1',2000)
- // else
- // select rightstring into :ls_str
- // from u_user
- // where empid = :ins_empid
- // and scid = :sys_scid;
- // if sqlca.sqlcode <> 0 or isnull(ls_str) then
- // ls_str = ''
- // end if
- // ls_str=f_psw_zh(ls_str,1,sys_power_key) //解密
- // ls_storage_str = dw_1.object.storagestr[ll_row]
- // ls_scstr = dw_1.object.scstr[ll_row]
- // end if
- //end if
- ////**storage_checkbox
- //for i = 1 to dw_2.rowcount()
- // if ls_storage_str = '0' then
- // dw_2.object.choice[i] = 1
- // else
- // ll_storageid = dw_2.object.storageid[i]
- // if pos(ls_storage_str,','+string(ll_storageid)+',',1) > 0 then
- // dw_2.object.choice[i] = 1
- // else
- // dw_2.object.choice[i] = 0
- // end if
- // end if
- //next
- //
- ////**sc_checkbox
- //for i = 1 to dw_3.rowcount()
- // if ls_scstr = '0' then
- // dw_3.object.choice[i] = 1
- // else
- // ll_scid = dw_3.object.scid[i]
- // if pos(ls_scstr,','+string(ll_scid)+',',1) > 0 then
- // dw_3.object.choice[i] = 1
- // else
- // dw_3.object.choice[i] = 0
- // end if
- // end if
- //next
- //**tv_checkbox
- //if ls_str = '' then return
- long ll_handl
- ll_handl = tv_func.finditem(RootTreeItem!,0)
- //if ll_handl > 0 then wf_refresh_tvchild(ll_handl,ls_str)
- return
- end subroutine
- public subroutine wf_clear_tvchild (long arg_handl, integer arg_statepictureindex);long ll_handl
- treeviewitem tvi
- ll_handl = arg_handl
- ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl)
- do while ll_handl > 0
- tv_func.getitem(ll_handl,tvi)
- tvi.statepictureindex = arg_statepictureindex
- tv_func.setitem(ll_handl,tvi)
-
- wf_clear_tvnext(ll_handl,arg_statepictureindex)
- ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl)
- loop
- end subroutine
- public subroutine wf_clear_tvnext (long arg_handl, integer arg_statepictureindex);long ll_handl
- treeviewitem tvi
- ll_handl = arg_handl
- ll_handl = tv_func.finditem(NextTreeItem!,ll_handl)
- do while ll_handl > 0
- tv_func.getitem(ll_handl,tvi)
- tvi.statepictureindex = arg_statepictureindex
- tv_func.setitem(ll_handl,tvi)
-
- wf_clear_tvchild(ll_handl,arg_statepictureindex)
- ll_handl = tv_func.finditem(NextTreeItem!,ll_handl)
- loop
- end subroutine
- public subroutine wf_set_tvnext (long arg_handl);//====================================================================
- // Function: wf_find_childtree()
- //--------------------------------------------------------------------
- // Description:
- //--------------------------------------------------------------------
- // Arguments:
- // value long arg_handl
- // value long arg_state
- //--------------------------------------------------------------------
- // Returns: integer
- //--------------------------------------------------------------------
- // Author: yyx Date: 2004.11.18
- //--------------------------------------------------------------------
- // Modify History:
- //
- //====================================================================
- long ll_handl
- treeviewitem tvi
- ll_handl = arg_handl
- tv_func.getitem(ll_handl,tvi)
- tvi.StatePictureIndex = 1
- tv_func.setitem(ll_handl,tvi)
- ll_handl = tv_func.finditem(NextTreeItem!,ll_handl)
- do while ll_handl > 0
- wf_set_tvchild(ll_handl)
- ll_handl = tv_func.finditem(NextTreeItem!,ll_handl)
- loop
- end subroutine
- on w_system_window_ch.create
- this.cb_refresh=create cb_refresh
- this.cb_ch=create cb_ch
- this.tv_func=create tv_func
- this.cb_exit=create cb_exit
- this.r_bar=create r_bar
- this.ln_bar=create ln_bar
- this.ln_bar2=create ln_bar2
- this.Control[]={this.cb_refresh,&
- this.cb_ch,&
- this.tv_func,&
- this.cb_exit,&
- this.r_bar,&
- this.ln_bar,&
- this.ln_bar2}
- end on
- on w_system_window_ch.destroy
- destroy(this.cb_refresh)
- destroy(this.cb_ch)
- destroy(this.tv_func)
- destroy(this.cb_exit)
- destroy(this.r_bar)
- destroy(this.ln_bar)
- destroy(this.ln_bar2)
- end on
- event open;cb_refresh.triggerevent(clicked!)
- end event
- event key;If key = KeyEnter! Or Key = KeyDownArrow! Then //
- keybd_event ( 9, 0, 0 , 0 ) // 按下tab
- keybd_event ( 9, 0, 2, 0 ) // 释放tab
- Return 1
- End If
- end event
- event resize;ln_bar.endx = this.width
- ln_bar2.endx = this.width
- r_bar.width = this.width
- tv_func.width = this.width - 20
- tv_func.height = this.height - 350
- end event
- event close;CLOSEWITHRETURN(THIS,cur_mainid)
- end event
- type cb_refresh from uo_imflatbutton within w_system_window_ch
- integer width = 165
- integer height = 164
- integer taborder = 180
- string text = "刷新"
- string normalpicname = "refresh.bmp"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;
- wf_build_functree()
- end event
- type cb_ch from uo_imflatbutton within w_system_window_ch
- integer x = 165
- integer width = 165
- integer height = 164
- integer taborder = 50
- string text = "选择"
- string normalpicname = "ok.bmp"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;Long ll_getitem,ll_newhandle
- s_sys_func ls_s_func
- TreeViewItem ltvi_Item
- IF il_handle <= 0 THEN
- MessageBox("系统提示","请选择系统窗口")
- RETURN
- END IF
- ll_getitem = tv_func.GetItem(il_handle, ltvi_Item)
- IF ll_getitem <= 0 THEN
- MessageBox("系统提示","请选择系统窗口")
- RETURN
- END IF
- ls_s_func = ltvi_Item.Data
- IF ls_s_func.functype <> 8 THEN
- MessageBox("系统提示","当前选择不是系统窗口")
- RETURN
- END IF
- cur_mainid = ls_s_func.mainid
- close(parent)
- end event
- type tv_func from treeview within w_system_window_ch
- integer y = 184
- integer width = 3109
- integer height = 1432
- integer taborder = 20
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- borderstyle borderstyle = stylelowered!
- boolean linesatroot = true
- boolean disabledragdrop = false
- boolean hideselection = false
- boolean tooltips = false
- string picturename[] = {"application.ico","graphics\Shell32 005.ico","graphics\blue folder.ico","graphics\Shell32 025.ico","Custom029!"}
- long picturemaskcolor = 536870912
- long statepicturemaskcolor = 536870912
- end type
- event clicked;int ls_state
- treeviewitem tvi
- tv_func.getitem(handle,tvi)
- ls_state = tvi.StatePictureIndex
- if handle > 0 then
- if ls_state = 2 then //孩子全部取消
- wf_set_tvchild(handle)
- elseif ls_state = 1 then//父亲选定
- wf_set_tvparent(handle)
- end if
- il_handle = handle
- end if
- end event
- event rightclicked;//IF Handle <= 0 THEN RETURN
- //il_handle = Handle
- //m_popup om_1
- //om_1 = CREATE m_popup
- ////把菜单的anyobject指向被右击的对象(dw_1)
- //om_1.anyobject = THIS
- ////om_1.setmenuitem("添加子项|添加兄弟|编辑|-|删除")
- ////可在此调用om_1.setitemdisable(itemorder)函数disable某菜单项。
- //om_1.popupmenu(THIS.X+THIS.PointerX(),THIS.Y+THIS.PointerY())
- //
- //DESTROY om_1
- //
- end event
- event doubleclicked;Long ll_getitem,ll_newhandle
- s_sys_func ls_s_func
- TreeViewItem ltvi_Item
- il_handle = Handle
- IF il_handle > 0 THEN
- ll_getitem = tv_func.GetItem(il_handle, ltvi_Item)
- IF ll_getitem > 0 THEN
- ls_s_func = ltvi_Item.Data
- IF ls_s_func.functype = 8 THEN
- cur_mainid = ls_s_func.mainid
- Close(PARENT)
- END IF
- END IF
- END IF
- end event
- type cb_exit from uo_imflatbutton within w_system_window_ch
- integer x = 329
- integer width = 165
- integer height = 164
- integer taborder = 170
- boolean bringtotop = true
- string text = "退出"
- string normalpicname = "exit.bmp"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;close(parent)
- end event
- type r_bar from rectangle within w_system_window_ch
- long linecolor = 16777215
- integer linethickness = 4
- long fillcolor = 1073741824
- integer x = 1257
- integer width = 146
- integer height = 68
- end type
- event constructor;this.fillcolor = 14215660
- this.linecolor = 14215660
- this.x = -1
- this.y = -1
- this.height = ln_bar.beginy - 5
- end event
- type ln_bar from line within w_system_window_ch
- long linecolor = 268435456
- integer linethickness = 4
- integer beginy = 168
- integer endx = 1481
- integer endy = 168
- end type
- type ln_bar2 from line within w_system_window_ch
- long linecolor = 16777215
- integer linethickness = 4
- integer beginy = 172
- integer endx = 1513
- integer endy = 172
- end type
|