w_formula_edit.srw 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. $PBExportHeader$w_formula_edit.srw
  2. forward
  3. global type w_formula_edit from w_publ_edit_choice
  4. end type
  5. end forward
  6. global type w_formula_edit from w_publ_edit_choice
  7. integer width = 2917
  8. integer height = 1444
  9. string title = "公式"
  10. end type
  11. global w_formula_edit w_formula_edit
  12. type variables
  13. String rst_colorname = ''
  14. end variables
  15. on w_formula_edit.create
  16. call super::create
  17. end on
  18. on w_formula_edit.destroy
  19. call super::destroy
  20. end on
  21. event close;call super::close;closewithreturn(this,rst_colorname)
  22. end event
  23. type cb_func from w_publ_edit_choice`cb_func within w_formula_edit
  24. end type
  25. type cb_exit from w_publ_edit_choice`cb_exit within w_formula_edit
  26. end type
  27. type cb_add from w_publ_edit_choice`cb_add within w_formula_edit
  28. end type
  29. event cb_add::clicked;call super::clicked;
  30. Long ll_newid,i
  31. String errmsg
  32. IF dw_edit_mode THEN
  33. dw_uc.AcceptText()
  34. IF dw_uc.GetNextModified(0, Primary!) = 0 THEN
  35. MessageBox('提示','没有任何修改,不可以保存!', Information!, OK! )
  36. RETURN
  37. END IF
  38. dw_uc.Object.content[dw_uc.GetRow()] = Trim(dw_uc.Object.content[dw_uc.GetRow()])
  39. IF dw_uc.Object.content[dw_uc.GetRow()] = '' THEN
  40. MessageBox('提示','请输入名称!', Information!, OK! )
  41. RETURN
  42. END IF
  43. IF dw_uc.Object.formulaid[dw_uc.GetRow()] = 0 THEN
  44. ll_newid = f_sys_scidentity(0,"u_formula_def","formulaid",errmsg,FALSE,sqlca)
  45. IF ll_newid <= 0 THEN
  46. MessageBox('提示',errmsg, Information!, OK! )
  47. RETURN
  48. ELSE
  49. dw_uc.Object.formulaid[dw_uc.GetRow()] = ll_newid
  50. END IF
  51. END IF
  52. END IF
  53. IF dw_edit_mode THEN
  54. String ls_errmsg
  55. IF dw_uc.Update() = -1 THEN
  56. IF Pos(ins_sqlerrtext,"Cannot insert duplicate key row") > 0 THEN
  57. ls_errmsg = "关键内容重复"
  58. ELSE
  59. ls_errmsg = "因为网络或其他原因>"+ins_sqlerrtext
  60. END IF
  61. ROLLBACK;
  62. MessageBox ('提示',ls_errmsg+",保存操作失败!", Information!, OK! )
  63. LS_UPDATE_FLAG = FALSE
  64. RETURN
  65. ELSE
  66. COMMIT;
  67. FOR i = 1 TO 3
  68. dw_uc.SetTabOrder ( i, 0 )
  69. NEXT
  70. LS_UPDATE_FLAG = TRUE
  71. END IF
  72. ins_sqlerrtext = ""
  73. ELSE
  74. Long li_row, li_cur_row
  75. li_cur_row = dw_uc.GetRow()
  76. li_row = dw_uc.InsertRow (0)
  77. FOR i = 1 TO 3
  78. dw_uc.SetTabOrder ( i, i*10 )
  79. NEXT
  80. dw_uc.SelectRow(0,FALSE)
  81. dw_uc.ScrollToRow (li_row)
  82. dw_uc.SelectRow(li_row,TRUE)
  83. dw_uc.SetFocus()
  84. modifyrow_no = li_row
  85. END IF
  86. dw_edit_mode = NOT dw_edit_mode
  87. WF_FACE_CHANGE()
  88. end event
  89. type cb_edit from w_publ_edit_choice`cb_edit within w_formula_edit
  90. end type
  91. event cb_edit::clicked;call super::clicked;
  92. Long i
  93. IF dw_edit_mode THEN
  94. IF dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = NewModified! OR dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = New! THEN
  95. dw_uc.DeleteRow(dw_uc.GetRow())
  96. ELSE
  97. dw_uc.ReselectRow(dw_uc.GetRow())
  98. END IF
  99. FOR i = 1 TO 3
  100. dw_uc.SetTabOrder ( i, 0 )
  101. NEXT
  102. modifyrow_no = 0
  103. ELSE
  104. modifyrow_no = dw_uc.GetRow()
  105. FOR i = 1 TO 3
  106. dw_uc.SetTabOrder ( i, i*10 )
  107. NEXT
  108. dw_uc.SetFocus()
  109. dw_uc.SelectRow(0,FALSE)
  110. dw_uc.ScrollToRow (modifyrow_no)
  111. dw_uc.SelectRow(modifyrow_no,TRUE)
  112. END IF
  113. dw_edit_mode = NOT dw_edit_mode
  114. WF_FACE_CHANGE()
  115. end event
  116. type cb_delet from w_publ_edit_choice`cb_delet within w_formula_edit
  117. end type
  118. event cb_delet::clicked;call super::clicked;
  119. IF MessageBox ('询问',"是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
  120. RETURN
  121. END IF
  122. string arg_msg
  123. IF DW_UC.GETROW()<=0 THEN
  124. MESSAGEBOX('提示','没有操作目标记录!', Information!, OK! )
  125. RETURN
  126. END IF
  127. dw_uc.SetRedraw (false)
  128. dw_UC.DeleteRow (0)
  129. dw_UC.TriggerEvent (rowfocuschanged!)
  130. if dw_UC.Update() = -1 then
  131. rollback;
  132. MessageBox ('提示',"删除记录操作失败!", Information!, OK! )
  133. else
  134. commit;
  135. end if
  136. dw_uc.SetRedraw (true)
  137. end event
  138. type cb_choice from w_publ_edit_choice`cb_choice within w_formula_edit
  139. end type
  140. event cb_choice::clicked;call super::clicked;Long li_row
  141. li_row = dw_uc.GetRow()
  142. if li_row <= 0 then
  143. messagebox(publ_operator,'请选择目标颜色')
  144. return
  145. end if
  146. rst_colorname = dw_uc.object.content[li_row]
  147. close(parent)
  148. end event
  149. type dw_uc from w_publ_edit_choice`dw_uc within w_formula_edit
  150. integer width = 2898
  151. integer height = 1160
  152. string dataobject = "dw_formula_edit"
  153. boolean hscrollbar = true
  154. end type
  155. event dw_uc::doubleclicked;call super::doubleclicked;IF dw_edit_mode THEN RETURN
  156. cb_choice.TriggerEvent(Clicked!)
  157. end event
  158. type cb_rtr from w_publ_edit_choice`cb_rtr within w_formula_edit
  159. end type
  160. type cb_help from w_publ_edit_choice`cb_help within w_formula_edit
  161. end type
  162. type ln_bar from w_publ_edit_choice`ln_bar within w_formula_edit
  163. end type
  164. type ln_bar2 from w_publ_edit_choice`ln_bar2 within w_formula_edit
  165. end type
  166. type r_bar from w_publ_edit_choice`r_bar within w_formula_edit
  167. end type