w_sortrow.srw 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. $PBExportHeader$w_sortrow.srw
  2. $PBExportComments$排序窗口
  3. forward
  4. global type w_sortrow from w_publ_base
  5. end type
  6. type cb_del from uo_imflatbutton within w_sortrow
  7. end type
  8. type cb_add from uo_imflatbutton within w_sortrow
  9. end type
  10. type cb_1 from uo_imflatbutton within w_sortrow
  11. end type
  12. type dw_criteria from u_dw within w_sortrow
  13. end type
  14. end forward
  15. global type w_sortrow from w_publ_base
  16. integer x = 617
  17. integer y = 364
  18. integer width = 1385
  19. integer height = 716
  20. string title = "排序"
  21. boolean minbox = false
  22. windowtype windowtype = response!
  23. cb_del cb_del
  24. cb_add cb_add
  25. cb_1 cb_1
  26. dw_criteria dw_criteria
  27. end type
  28. global w_sortrow w_sortrow
  29. type variables
  30. Long i_lRow
  31. String i_aszTypes[]
  32. DataWindow i_dwToActOn
  33. end variables
  34. on w_sortrow.create
  35. int iCurrent
  36. call super::create
  37. this.cb_del=create cb_del
  38. this.cb_add=create cb_add
  39. this.cb_1=create cb_1
  40. this.dw_criteria=create dw_criteria
  41. iCurrent=UpperBound(this.Control)
  42. this.Control[iCurrent+1]=this.cb_del
  43. this.Control[iCurrent+2]=this.cb_add
  44. this.Control[iCurrent+3]=this.cb_1
  45. this.Control[iCurrent+4]=this.dw_criteria
  46. end on
  47. on w_sortrow.destroy
  48. call super::destroy
  49. destroy(this.cb_del)
  50. destroy(this.cb_add)
  51. destroy(this.cb_1)
  52. destroy(this.dw_criteria)
  53. end on
  54. event open;call super::open;Integer nColumnCount, nColumnIndex
  55. String szColumn
  56. Long lRow
  57. DataWindowChild dwcColumns
  58. string des_1,des_2
  59. i_dwToActOn = Message.PowerObjectParm
  60. i_lRow = 0
  61. nColumnCount = Integer( i_dwToActOn.Object.DataWindow.Column.Count)
  62. dw_criteria.GetChild( "column_number", dwcColumns)
  63. i_aszTypes[ nColumnCount] = ""
  64. For nColumnIndex = 1 To nColumnCount
  65. des_1= i_dwToActOn.Describe( "#" + String(nColumnIndex) + ".Name")
  66. des_2= i_dwtoacton.describe(des_1+ "_t.Text")
  67. szColumn = f_strip( i_dwToActOn.Describe( i_dwToActOn.Describe( "#" + String(nColumnIndex) + ".Name") + "_t.Text"))
  68. If szColumn <> "!" Then
  69. lRow = dwcColumns.InsertRow( 0)
  70. dwcColumns.SetItem( lRow, "column_name", szColumn)
  71. dwcColumns.SetItem( lRow, "column_number", nColumnIndex)
  72. i_aszTypes[ nColumnIndex] = i_dwToActOn.Describe( "#" + String(nColumnIndex) + ".ColType")
  73. End If
  74. Next
  75. dw_criteria.TriggerEvent( "NewRow")
  76. end event
  77. type cb_func from w_publ_base`cb_func within w_sortrow
  78. boolean visible = false
  79. integer y = 488
  80. boolean enabled = false
  81. end type
  82. type cb_exit from w_publ_base`cb_exit within w_sortrow
  83. integer x = 791
  84. integer y = 488
  85. integer width = 325
  86. string text = "取消"
  87. end type
  88. type cb_del from uo_imflatbutton within w_sortrow
  89. integer x = 1001
  90. integer y = 136
  91. integer width = 325
  92. integer height = 96
  93. integer taborder = 41
  94. string text = "删除行"
  95. end type
  96. event clicked;call super::clicked;dw_criteria.TriggerEvent( "DELETERow")
  97. end event
  98. type cb_add from uo_imflatbutton within w_sortrow
  99. integer x = 1001
  100. integer y = 16
  101. integer width = 325
  102. integer height = 96
  103. integer taborder = 41
  104. string text = "增加行"
  105. end type
  106. event clicked;call super::clicked;dw_criteria.TriggerEvent( "NewRow")
  107. end event
  108. type cb_1 from uo_imflatbutton within w_sortrow
  109. integer x = 311
  110. integer y = 488
  111. integer width = 325
  112. integer height = 96
  113. integer taborder = 41
  114. boolean default = true
  115. end type
  116. event clicked;call super::clicked;Long lNoOfCriteria, lRow, lColumnNo,lLen
  117. Integer nPos
  118. String szFind,szColumn,szOperator
  119. STRING szExpression=''
  120. lNoOfCriteria = dw_criteria.RowCount()
  121. For lRow = 1 To lNoOfCriteria
  122. lColumnNo = dw_criteria.GetItemNumber( lRow, "column_number")
  123. szColumn = i_dwToActOn.Describe( "#" + String( lColumnNo) + ".Name")//dbName //FILTER 与SELECT 区别
  124. If IsNull( dw_criteria.GetItemNumber( lrow, "column_number")) Then
  125. exit
  126. End If
  127. szOperator = ( dw_criteria.GetItemString( lRow, "operators"))
  128. szExpression = szExpression + szColumn +' '+ szOperator + ','
  129. Next
  130. SZFIND=trim(szExpression)
  131. if right(SZFIND,1)=',' THEN
  132. SZFIND=LEFT(SZFIND,LEN(SZFIND) - 1)
  133. END IF
  134. //
  135. //MESSAGEBOX('',SZFIND)
  136. //
  137. Closewithreturn(parent,szfind)
  138. end event
  139. type dw_criteria from u_dw within w_sortrow
  140. integer x = 18
  141. integer y = 12
  142. integer width = 951
  143. integer height = 448
  144. integer taborder = 20
  145. boolean bringtotop = true
  146. string dataobject = "d_sort"
  147. boolean vscrollbar = true
  148. boolean border = false
  149. end type