uo_tv_menu_fx.sru 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. $PBExportHeader$uo_tv_menu_fx.sru
  2. $PBExportComments$协同系统的treeview menu
  3. forward
  4. global type uo_tv_menu_fx from treeview
  5. end type
  6. end forward
  7. global type uo_tv_menu_fx from treeview
  8. integer width = 549
  9. integer height = 476
  10. integer textsize = -9
  11. integer weight = 400
  12. fontcharset fontcharset = gb2312charset!
  13. fontpitch fontpitch = variable!
  14. string facename = "宋体"
  15. long textcolor = 33554432
  16. borderstyle borderstyle = stylelowered!
  17. string picturename[] = {"graphics\application_fx.gif","graphics\Shell32 005.bmp","graphics\application_fx.gif","graphics\application_fx.gif","graphics\application_fx.gif","graphics\application_fx.gif","graphics\application_fx.gif","graphics\application_fx.gif","graphics\application_fx.gif","graphics\task.bmp"}
  18. integer picturewidth = 16
  19. integer pictureheight = 16
  20. long picturemaskcolor = 536870912
  21. long statepicturemaskcolor = 536870912
  22. end type
  23. global uo_tv_menu_fx uo_tv_menu_fx
  24. type variables
  25. datastore ins_ds
  26. end variables
  27. forward prototypes
  28. public subroutine init (readonly datastore arg_ds)
  29. public subroutine uof_treegrowth (long arg_handl, long arg_parentid)
  30. end prototypes
  31. public subroutine init (readonly datastore arg_ds);//
  32. IF IsValid(ins_ds) THEN
  33. Destroy ins_ds
  34. END IF
  35. ins_ds = Create datastore
  36. if arg_ds.DataObject <> 'ds_menu_fx' then
  37. MessageBox('提示', '使用的arg_ds参数有误')
  38. return
  39. end if
  40. ins_ds = arg_ds
  41. ins_ds.SetSort('parentid,sortflag')
  42. ins_ds.Sort()
  43. this.SetRedraw(false)
  44. DO UNTIL This.FindItem(RootTreeItem!, 0) = -1
  45. This.DeleteItem(0)
  46. LOOP
  47. long ll_hand_root
  48. ll_hand_root = This.InsertItemLast(0, '协同系统',1)
  49. uof_treegrowth(ll_hand_root, 0)
  50. This.ExpandItem(ll_hand_root)
  51. long ll_hand
  52. ll_hand = This.FindItem(ChildTreeItem!, ll_hand_root)
  53. DO UNTIL ll_hand = - 1
  54. This.ExpandItem(ll_hand)
  55. ll_hand = This.FindItem(NextTreeItem!, ll_hand)
  56. LOOP
  57. this.SetRedraw(true)
  58. //Destroy ins_ds ChildTreeItem! NextTreeItem!
  59. end subroutine
  60. public subroutine uof_treegrowth (long arg_handl, long arg_parentid);//
  61. Long li_handl
  62. TreeViewItem l_tvi
  63. Long ll_row, ll_rowChild
  64. ll_row = ins_ds.Find("parentid = " + String(arg_parentid) + ' and functype <> 9', 1, ins_ds.RowCount())
  65. //ll_row = ins_ds.Find("parentid = " + String(arg_parentid), 1, ins_ds.RowCount())
  66. string treename, objname
  67. long funcid, functype
  68. DO WHILE ll_row > 0
  69. treename = ins_ds.Object.treename[ll_row]
  70. // objname = ins_ds.Object.objname[ll_row]
  71. funcid = ins_ds.Object.funcid[ll_row]
  72. functype = ins_ds.Object.functype[ll_row]
  73. li_handl = This.InsertItemLast(arg_handl, treename, functype + 2)
  74. ll_rowChild = ins_ds.Find("parentid = " + String(funcid) + ' and functype <> 9', 1, ins_ds.RowCount())
  75. // ll_rowChild = ins_ds.Find("parentid = " + String(funcid), 1, ins_ds.RowCount())
  76. IF This.GetItem(li_handl, l_tvi) = 1 THEN
  77. l_tvi.Label = treename
  78. l_tvi.Data = funcid
  79. IF ll_rowChild > 0 THEN
  80. l_tvi.Children = True
  81. END IF
  82. This.SetItem(li_handl, l_tvi)
  83. uof_treegrowth(li_handl, funcid)
  84. END IF
  85. IF ll_row >= ins_ds.RowCount() THEN EXIT
  86. ll_row = ins_ds.Find("parentid = " + String(arg_parentid) + ' and functype <> 9', ll_row + 1, ins_ds.RowCount())
  87. // ll_row = ins_ds.Find("parentid = " + String(arg_parentid), ll_row + 1, ins_ds.RowCount())
  88. LOOP
  89. end subroutine
  90. on uo_tv_menu_fx.create
  91. end on
  92. on uo_tv_menu_fx.destroy
  93. end on
  94. event doubleclicked;//
  95. long ll_hand, funcid
  96. treeviewitem tvi
  97. ll_hand = THIS.FindItem(currenttreeitem!, 0)
  98. THIS.GetItem(ll_hand, tvi)
  99. funcid = long(tvi.Data)
  100. if IsNull(funcid) then return
  101. if (funcid <= 0) then return
  102. long row
  103. string objname
  104. if IsValid(w_main_fx) and IsValid(sys_func_pwr) then
  105. sys_func_pwr.SetFilter('')
  106. sys_func_pwr.Filter()
  107. row = sys_func_pwr.Find('funcid = ' + string(funcid), 1, sys_func_pwr.RowCount())
  108. if (row <= 0) then return
  109. objname = sys_func_pwr.Object.objname[row]
  110. if IsNull(objname) then return
  111. if (objname = '') then return
  112. w_main_fx.PostEvent('ue_main_menu_commnd', 0, funcid)
  113. // Message.LongParm = funcid
  114. // w_main_fx.Post Event ue_main_menu_commnd()
  115. end if
  116. end event