123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643 |
- $PBExportHeader$uo_aifmb_tv_class.sru
- forward
- global type uo_aifmb_tv_class from userobject
- end type
- type sle_1 from singlelineedit within uo_aifmb_tv_class
- end type
- type tv_1 from treeview within uo_aifmb_tv_class
- end type
- type cb_1 from uo_imflatbutton within uo_aifmb_tv_class
- end type
- type cb_reflash from uo_imflatbutton within uo_aifmb_tv_class
- end type
- end forward
- global type uo_aifmb_tv_class from userobject
- integer width = 795
- integer height = 1128
- long backcolor = 67108864
- string text = "none"
- borderstyle borderstyle = stylelowered!
- long tabtextcolor = 33554432
- long picturemaskcolor = 536870912
- event ue_size pbm_size
- event ue_selectionchanged ( )
- event ue_retrieve ( )
- event ue_retrieve_all ( )
- sle_1 sle_1
- tv_1 tv_1
- cb_1 cb_1
- cb_reflash cb_reflash
- end type
- global uo_aifmb_tv_class uo_aifmb_tv_class
- type variables
- long uo_nodeid_arr[]
- string uo_keyword
- boolean uo_withindex = false
- private:
- datastore ds_classgroup
- datastore ds_classnode
- datastore ds_relation
- datastore ds_shortcut
- long ins_root = 0
- long ins_select = 0
- s_aifmb_tvi cur_data
- long ins_userid = 0
- end variables
- forward prototypes
- public function s_aifmb_tvi pf_getdata (long arg_handle)
- private subroutine pf_build_child (long arg_handle)
- public subroutine pf_getnodeid (long arg_handle, ref long arg_nodeid_arr[])
- public subroutine uf_build_tree ()
- public function long pf_tv_next (long arg_handle)
- end prototypes
- event ue_size;tv_1.Width = this.Width - tv_1.X
- tv_1.Height = this.Height - tv_1.Y
- end event
- event ue_selectionchanged();// long uo_nodeid_arr[]
- end event
- event ue_retrieve();uo_aifmb = Create uo_aifmb
- String ls_msg
- IF uo_aifmb.uf_sync_node_bytime(ls_msg) <> 1 THEN
- MessageBox('ERROR', ls_msg)
- GOTO ext
- END IF
- uf_build_tree()
- ext:
- Destroy uo_aifmb
- end event
- event ue_retrieve_all();uo_aifmb = Create uo_aifmb
- String ls_msg
- IF uo_aifmb.uf_sync_node(ls_msg) <> 1 THEN
- MessageBox('ERROR', ls_msg)
- GOTO ext
- END IF
- uf_build_tree()
- ext:
- Destroy uo_aifmb
- end event
- public function s_aifmb_tvi pf_getdata (long arg_handle);s_aifmb_tvi rslt
- rslt.reltype = 0
- rslt.relid = 0
- treeviewitem tvi
- IF arg_handle > 0 THEN
- IF tv_1.GetItem(arg_handle, tvi) = 1 THEN
- IF Not IsNull(tvi.Data) THEN
- rslt = tvi.Data
- END IF
- END IF
- END IF
- RETURN rslt
- end function
- private subroutine pf_build_child (long arg_handle);s_aifmb_tvi s_data
- treeviewitem tvi
- Long ll_handles[]
- Long ll_cnt = 0, ll_handle
- Long i, j
- // // 根
- // s_data.reltype = 0
- // s_data.relid = 0
- // tvi.Data = s_data
- // tvi.PictureIndex = 1
- // tvi.SelectedPictureIndex = 1
- // tvi.Label = '全部类别'
- // ll_handle = tv_1.InsertItemLast(arg_handle, tvi)
- // IF ll_handle > 0 THEN
- // ll_cnt++
- // ll_handles[ll_cnt] = ll_handle
- // ins_root = ll_handle
- // END IF
- // IF s_data.reltype = cur_data.reltype And s_data.relid = cur_data.relid THEN
- // ins_select = ll_handle
- // END IF
- IF arg_handle = 0 THEN
- // 标准分类根
- s_data.reltype = 11
- s_data.relid = 0
- tvi.Data = s_data
- tvi.PictureIndex = 1
- tvi.SelectedPictureIndex = 1
- tvi.Label = '标准分类'
- ll_handle = tv_1.InsertItemLast(arg_handle, tvi)
- IF ll_handle > 0 THEN
- ll_cnt++
- ll_handles[ll_cnt] = ll_handle
- ins_root = ll_handle
- END IF
- IF s_data.reltype = cur_data.reltype And s_data.relid = cur_data.relid THEN
- ins_select = ll_handle
- END IF
-
- // 行业分类根
- s_data.reltype = 12
- s_data.relid = 0
- tvi.Data = s_data
- tvi.PictureIndex = 1
- tvi.SelectedPictureIndex = 1
- tvi.Label = '行业分类'
- ll_handle = tv_1.InsertItemLast(arg_handle, tvi)
- IF ll_handle > 0 THEN
- ll_cnt++
- ll_handles[ll_cnt] = ll_handle
- END IF
- IF s_data.reltype = cur_data.reltype And s_data.relid = cur_data.relid THEN
- ins_select = ll_handle
- END IF
-
- IF ins_userid > 0 THEN
-
- // 我的分类根
- s_data.reltype = 13
- s_data.relid = 0
- tvi.Data = s_data
- tvi.PictureIndex = 1
- tvi.SelectedPictureIndex = 1
- tvi.Label = '我的分类'
- ll_handle = tv_1.InsertItemLast(arg_handle, tvi)
- IF ll_handle > 0 THEN
- ll_cnt++
- ll_handles[ll_cnt] = ll_handle
- END IF
- IF s_data.reltype = cur_data.reltype And s_data.relid = cur_data.relid THEN
- ins_select = ll_handle
- END IF
-
- END IF
-
- IF uo_withindex THEN
- s_data.reltype = 2
- s_data.relid = 0
- tvi.Data = s_data
- tvi.PictureIndex = 3
- tvi.SelectedPictureIndex = 3
- tvi.Label = '指数'
- ll_handle = tv_1.InsertItemLast(arg_handle, tvi)
- IF s_data.reltype = cur_data.reltype And s_data.relid = cur_data.relid THEN
- ins_select = ll_handle
- END IF
- END IF
-
- ELSE
- s_data = pf_getdata(arg_handle)
-
- IF s_data.reltype = 11 THEN
-
- // 分类
- ds_classgroup.SetFilter("parentid = 0")
- ds_classgroup.Filter()
- FOR i = 1 To ds_classgroup.RowCount()
- s_data.reltype = 1
- s_data.relid = ds_classgroup.Object.classid[i]
- tvi.Data = s_data
- tvi.PictureIndex = 2
- tvi.SelectedPictureIndex = 2
- tvi.Label = ds_classgroup.Object.ClassName[i]
- ll_handle = tv_1.InsertItemLast(arg_handle, tvi)
- IF ll_handle > 0 THEN
- ll_cnt++
- ll_handles[ll_cnt] = ll_handle
- END IF
- IF s_data.reltype = cur_data.reltype And s_data.relid = cur_data.relid THEN
- ins_select = ll_handle
- END IF
- NEXT
-
- ELSEIF s_data.reltype = 12 THEN
- // 行业分类
- ds_shortcut.SetFilter("parentid = 0 AND userid = 0")
- ds_shortcut.Filter()
- FOR i = 1 To ds_shortcut.RowCount()
- s_data.reltype = 3
- s_data.relid = ds_shortcut.Object.linkid[i]
- tvi.Data = s_data
- tvi.PictureIndex = 3
- tvi.SelectedPictureIndex = 3
- tvi.Label = ds_shortcut.Object.linkname[i]
- ll_handle = tv_1.InsertItemLast(arg_handle, tvi)
- IF ll_handle > 0 THEN
- ll_cnt++
- ll_handles[ll_cnt] = ll_handle
- END IF
- IF s_data.reltype = cur_data.reltype And s_data.relid = cur_data.relid THEN
- ins_select = ll_handle
- END IF
- NEXT
- ELSEIF s_data.reltype = 13 THEN
- // 我的分类
- ds_shortcut.SetFilter("parentid = 0 AND userid = " + String(ins_userid))
- ds_shortcut.Filter()
- FOR i = 1 To ds_shortcut.RowCount()
- s_data.reltype = 3
- s_data.relid = ds_shortcut.Object.linkid[i]
- s_data.queryvalue = ds_shortcut.Object.queryvalue[i]
- tvi.Data = s_data
- tvi.PictureIndex = 3
- tvi.SelectedPictureIndex = 3
- tvi.Label = ds_shortcut.Object.linkname[i]
- ll_handle = tv_1.InsertItemLast(arg_handle, tvi)
- IF ll_handle > 0 THEN
- ll_cnt++
- ll_handles[ll_cnt] = ll_handle
- END IF
- IF s_data.reltype = cur_data.reltype And s_data.relid = cur_data.relid THEN
- ins_select = ll_handle
- END IF
- NEXT
-
- ELSEIF s_data.reltype = 3 THEN
- // 快捷方式
- ds_shortcut.SetFilter("parentid = " + String(s_data.relid))
- ds_shortcut.Filter()
- FOR i = 1 To ds_shortcut.RowCount()
- s_data.reltype = 3
- s_data.relid = ds_shortcut.Object.linkid[i]
- s_data.queryvalue = ds_shortcut.Object.queryvalue[i]
- tvi.Data = s_data
- tvi.PictureIndex = 3
- tvi.SelectedPictureIndex = 3
- tvi.Label = ds_shortcut.Object.linkname[i]
- ll_handle = tv_1.InsertItemLast(arg_handle, tvi)
- IF ll_handle > 0 THEN
- ll_cnt++
- ll_handles[ll_cnt] = ll_handle
- END IF
- IF s_data.reltype = cur_data.reltype And s_data.relid = cur_data.relid THEN
- ins_select = ll_handle
- END IF
- NEXT
-
- ELSEIF s_data.reltype = 1 THEN
- ds_classgroup.SetFilter("parentid = " + String(s_data.relid))
- ds_classgroup.Filter()
- ds_relation.SetFilter("classid = " + String(s_data.relid))
- ds_relation.Filter()
- // 分类
- FOR i = 1 To ds_classgroup.RowCount()
- s_data.reltype = 1
- s_data.relid = ds_classgroup.Object.classid[i]
- tvi.Data = s_data
- tvi.PictureIndex = 2
- tvi.SelectedPictureIndex = 2
- tvi.Label = ds_classgroup.Object.ClassName[i]
- ll_handle = tv_1.InsertItemLast(arg_handle, tvi)
- IF ll_handle > 0 THEN
- ll_cnt++
- ll_handles[ll_cnt] = ll_handle
- END IF
- IF s_data.reltype = cur_data.reltype And s_data.relid = cur_data.relid THEN
- ins_select = ll_handle
- END IF
- NEXT
-
- // 基类
- FOR i = 1 To ds_relation.RowCount()
- j = ds_classnode.Find("nodeid = " + String(ds_relation.Object.nodeid[i]), 1, ds_classnode.RowCount())
- IF j > 0 THEN
- s_data.reltype = 2
- s_data.relid = ds_relation.Object.nodeid[i]
- tvi.Data = s_data
- tvi.PictureIndex = 3
- tvi.SelectedPictureIndex = 3
- tvi.Label = ds_classnode.Object.nodename[j] + '['+ds_classnode.Object.nodecode[j]+']'
- ll_handle = tv_1.InsertItemLast(arg_handle, tvi)
- IF s_data.reltype = cur_data.reltype And s_data.relid = cur_data.relid THEN
- ins_select = ll_handle
- END IF
- END IF
- NEXT
- END IF
- END IF
- FOR i = 1 To ll_cnt
- pf_build_child(ll_handles[i])
- NEXT
- end subroutine
- public subroutine pf_getnodeid (long arg_handle, ref long arg_nodeid_arr[]);s_aifmb_tvi s_data
- s_data = pf_getdata(arg_handle)
- Long i, j, ll_nodeid
- Long ll_pos
- String ls_nodeid
- Boolean lb_find = False
- i = UpperBound(arg_nodeid_arr)
- IF s_data.reltype = 2 THEN // 基类
- FOR j = 1 To i
- IF arg_nodeid_arr[j] = s_data.relid THEN
- RETURN
- END IF
- NEXT
- arg_nodeid_arr[j] = s_data.relid
- RETURN
- ELSEIF s_data.reltype = 3 THEN
- ll_pos = Pos(cur_data.queryvalue, ';')
- IF ll_pos > 0 THEN
- ls_nodeid = Mid(cur_data.queryvalue, 1, ll_pos - 1)
- IF IsNumber(ls_nodeid) THEN
- ll_nodeid = Long(ls_nodeid)
- lb_find = False
- FOR j = 1 To i
- IF arg_nodeid_arr[j] = ll_nodeid THEN
- lb_find = True
- EXIT
- END IF
- NEXT
- IF Not lb_find THEN
- arg_nodeid_arr[j] = ll_nodeid
- END IF
- END IF
- END IF
- END IF
- Long ll_first
- ll_first = tv_1.FindItem(ChildTreeItem!, arg_handle)
- DO WHILE ll_first > 0
- pf_getnodeid(ll_first, arg_nodeid_arr)
- ll_first = tv_1.FindItem(NextTreeItem!, ll_first)
- LOOP
- end subroutine
- public subroutine uf_build_tree ();long ll_handle
- s_aifmb_tvi old_data
- old_data = cur_data
- ll_handle = tv_1.FindItem(RootTreeItem!, 0)
- do while ll_handle > 0
- tv_1.DeleteItem(ll_handle)
- ll_handle = tv_1.FindItem(RootTreeItem!, 0)
- loop
- cur_data = old_data
- ds_classgroup.SetTransObject(sqlca)
- ds_classnode.SetTransObject(sqlca)
- ds_relation.SetTransObject(sqlca)
- ds_shortcut.SetTransObject(sqlca)
- ds_classgroup.Retrieve()
- ds_classnode.Retrieve()
- ds_relation.Retrieve()
- uo_aifmb = create uo_aifmb
- ins_userid = uo_aifmb.sf_userid()
- ds_shortcut.Retrieve(ins_userid)
- destroy uo_aifmb
- pf_build_child(0)
- tv_1.ExpandAll(ins_root)
- IF ins_select > 0 THEN
- tv_1.SelectItem(ins_select)
- tv_1.SetFirstVisible(ins_select)
- tv_1.trigger event selectionchanged(0, ins_select)
- ELSE
- tv_1.SelectItem(ins_root)
- tv_1.SetFirstVisible(ins_root)
- tv_1.trigger event selectionchanged(0, ins_root)
- END IF
- end subroutine
- public function long pf_tv_next (long arg_handle);Long nexthandle = -1
- nexthandle = tv_1.FindItem(ChildTreeItem!, arg_handle)
- IF nexthandle > 0 THEN RETURN nexthandle
- nexthandle = tv_1.FindItem(NextTreeItem!, arg_handle)
- IF nexthandle > 0 THEN RETURN nexthandle
- Long p
- p = tv_1.FindItem(ParentTreeItem!, arg_handle)
- DO WHILE p > 0
- nexthandle = tv_1.FindItem(NextTreeItem!, p)
- IF nexthandle > 0 THEN RETURN nexthandle
- p = tv_1.FindItem(ParentTreeItem!, p)
- LOOP
- RETURN nexthandle
- end function
- on uo_aifmb_tv_class.create
- this.sle_1=create sle_1
- this.tv_1=create tv_1
- this.cb_1=create cb_1
- this.cb_reflash=create cb_reflash
- this.Control[]={this.sle_1,&
- this.tv_1,&
- this.cb_1,&
- this.cb_reflash}
- end on
- on uo_aifmb_tv_class.destroy
- destroy(this.sle_1)
- destroy(this.tv_1)
- destroy(this.cb_1)
- destroy(this.cb_reflash)
- end on
- event constructor;this.backcolor = 14215660
- ds_classgroup = Create datastore
- ds_classnode = Create datastore
- ds_relation = Create datastore
- ds_shortcut = create datastore
- ds_classgroup.DataObject = 'ds_aifmb_classgroup'
- ds_classnode.DataObject = 'ds_aifmb_classnode'
- ds_relation.DataObject = 'ds_aifmb_relation'
- ds_shortcut.DataObject = 'ds_aifmb_shortcut'
- string ls_data
- ls_data = f_ProfileString(sys_empid, classname(parent), classname(this), '0_0')
- long ll_pos
- ll_pos = pos(ls_data, '_')
- if ll_pos > 0 then
- cur_data.reltype = long(mid(ls_data, 1, ll_pos - 1))
- cur_data.relid = long(mid(ls_data, ll_pos + 1))
- end if
- uf_build_tree()
- end event
- event destructor;Destroy ds_classgroup
- Destroy ds_classnode
- Destroy ds_relation
- destroy ds_shortcut
- f_SetProfilestring(sys_empid, ClassName(Parent), ClassName(This), String(cur_data.reltype) + '_' + String(cur_data.relid))
- end event
- type sle_1 from singlelineedit within uo_aifmb_tv_class
- event ue_keydown pbm_keydown
- integer x = 238
- integer y = 4
- integer width = 402
- integer height = 84
- integer taborder = 30
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- borderstyle borderstyle = stylelowered!
- end type
- event ue_keydown;
- String ls_keyword = ''
- ls_keyword = Trim(sle_1.Text, True)
- Long cur_handle = 0
- Long next_handle = 0
- treeviewitem tvi
- IF Key = keyenter! THEN
-
- IF ls_keyword = '' THEN RETURN
-
- cur_handle = tv_1.FindItem(CurrentTreeItem!,0)
- IF cur_handle > 0 THEN
- next_handle = pf_tv_next(cur_handle)
- DO WHILE next_handle > 0
- IF tv_1.GetItem(next_handle, tvi) = 1 THEN
- IF Pos(tvi.Label, ls_keyword) > 0 THEN
- tv_1.SelectItem(next_handle)
- tv_1.SetFirstVisible(next_handle)
- RETURN
- END IF
- END IF
- next_handle = pf_tv_next(next_handle)
- LOOP
-
- next_handle = tv_1.FindItem(RootTreeItem!, 0)
- DO WHILE next_handle > 0
- IF next_handle = cur_handle THEN RETURN
- IF tv_1.GetItem(next_handle, tvi) = 1 THEN
- IF Pos(tvi.Label, ls_keyword) > 0 THEN
- tv_1.SelectItem(next_handle)
- tv_1.SetFirstVisible(next_handle)
- RETURN
- END IF
- END IF
- next_handle = pf_tv_next(next_handle)
- LOOP
-
- END IF
-
- END IF
- end event
- type tv_1 from treeview within uo_aifmb_tv_class
- integer y = 88
- integer width = 736
- integer height = 916
- integer taborder = 30
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- borderstyle borderstyle = stylelowered!
- boolean hideselection = false
- string picturename[] = {"Application!","Structure5!","UserObject5!"}
- long picturemaskcolor = 536870912
- long statepicturemaskcolor = 536870912
- end type
- event selectionchanged;Long arr_nodeid[]
- Long ll_pos, ll_p2
- uo_keyword = ''
- String ls_nodeid
- cur_data = pf_getdata(newhandle)
- pf_getnodeid(newhandle, arr_nodeid)
- IF cur_data.reltype = 3 THEN
- ll_pos = Pos(cur_data.queryvalue, ';')
- IF ll_pos > 0 THEN
- ll_pos = Pos(cur_data.queryvalue, ';', ll_pos + 1)
- IF ll_pos > 0 THEN
- ll_p2 = Pos(cur_data.queryvalue, ';', ll_pos + 1)
- IF ll_p2 > 0 THEN
- uo_keyword = Mid(cur_data.queryvalue, ll_pos + 1, ll_p2 - ll_pos - 1)
- ELSE
- uo_keyword = Mid(cur_data.queryvalue, ll_pos + 1)
- END IF
- END IF
- END IF
- END IF
- IF UpperBound(arr_nodeid) = 0 THEN
- arr_nodeid[1] = -1
- END IF
- uo_nodeid_arr = arr_nodeid
- Parent.TriggerEvent('ue_selectionchanged')
- end event
- type cb_1 from uo_imflatbutton within uo_aifmb_tv_class
- integer x = 114
- integer width = 114
- integer height = 88
- integer taborder = 20
- string text = ""
- string normalpicname = "imexport.BMP"
- integer picsize = 16
- boolean border = false
- end type
- event clicked;call super::clicked;parent.triggerevent('ue_retrieve_all')
- end event
- type cb_reflash from uo_imflatbutton within uo_aifmb_tv_class
- integer width = 114
- integer height = 88
- integer taborder = 10
- string text = ""
- string normalpicname = "refresh.BMP"
- integer picsize = 16
- boolean border = false
- end type
- event clicked;call super::clicked;parent.triggerevent('ue_retrieve')
- end event
|