w_publ_edit_choice.srw 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. $PBExportHeader$w_publ_edit_choice.srw
  2. $PBExportComments$定义加选择窗口
  3. forward
  4. global type w_publ_edit_choice from w_publ_base
  5. end type
  6. type cb_add from uo_imflatbutton within w_publ_edit_choice
  7. end type
  8. type cb_edit from uo_imflatbutton within w_publ_edit_choice
  9. end type
  10. type cb_delet from uo_imflatbutton within w_publ_edit_choice
  11. end type
  12. type cb_choice from uo_imflatbutton within w_publ_edit_choice
  13. end type
  14. type dw_uc from u_dw_rbtnfilter within w_publ_edit_choice
  15. end type
  16. type cb_rtr from uo_imflatbutton within w_publ_edit_choice
  17. end type
  18. type cb_help from uo_imflatbutton within w_publ_edit_choice
  19. end type
  20. type ln_bar from line within w_publ_edit_choice
  21. end type
  22. type ln_bar2 from line within w_publ_edit_choice
  23. end type
  24. type r_bar from rectangle within w_publ_edit_choice
  25. end type
  26. end forward
  27. global type w_publ_edit_choice from w_publ_base
  28. integer width = 2062
  29. integer height = 1560
  30. string title = "编缉"
  31. boolean minbox = false
  32. windowtype windowtype = response!
  33. event retrieve_uc ( )
  34. event ue_help ( )
  35. event user_key ( )
  36. cb_add cb_add
  37. cb_edit cb_edit
  38. cb_delet cb_delet
  39. cb_choice cb_choice
  40. dw_uc dw_uc
  41. cb_rtr cb_rtr
  42. cb_help cb_help
  43. ln_bar ln_bar
  44. ln_bar2 ln_bar2
  45. r_bar r_bar
  46. end type
  47. global w_publ_edit_choice w_publ_edit_choice
  48. type variables
  49. boolean ls_update_flag=true
  50. long modifyrow_no=0,crl_row //当前行记录
  51. s_edit_tran para_obj //环境信息用于查询
  52. string keyword_string //关键字 未用
  53. date first_date //查询开始日
  54. date end_date //查询结束日,比表达日后一天
  55. int child_column_int //明细dw锁定列数
  56. string ins_sqlerrtext
  57. end variables
  58. forward prototypes
  59. public function integer wf_face_change ()
  60. end prototypes
  61. event retrieve_uc();dw_UC.retrieve()
  62. end event
  63. event ue_help();Int i
  64. i = htmlhelpA(Handle(THIS), sys_help_chm, 0, THIS.Title+".html")
  65. end event
  66. event user_key();IF KeyDown(KeyF1!) THEN
  67. THIS.TriggerEvent('ue_help')
  68. end if
  69. end event
  70. public function integer wf_face_change ();IF dw_edit_mode THEN
  71. cb_func.Enabled = FALSE
  72. cb_choice.Enabled = FALSE
  73. cb_delet.Enabled = FALSE
  74. cb_rtr.Enabled = FALSE
  75. cb_edit.Text = "放弃&E"
  76. cb_add.Text = "保存&S"
  77. cb_edit.normalpicname = 'Undo.bmp'
  78. cb_add.normalpicname = 'Save.bmp'
  79. ELSE
  80. cb_func.Enabled = TRUE
  81. cb_delet.Enabled = TRUE
  82. cb_choice.Enabled = TRUE
  83. cb_rtr.Enabled = TRUE
  84. cb_edit.Text = "修改&E"
  85. cb_add.Text = "新建&S"
  86. cb_edit.normalpicname = 'OPEN.bmp'
  87. cb_add.normalpicname = 'new.bmp'
  88. END IF
  89. cb_edit.of_init_draw()
  90. cb_add.of_init_draw()
  91. cb_edit.of_paint()
  92. cb_add.of_paint()
  93. cb_add.TriggerEvent('ue_textchange')
  94. cb_edit.TriggerEvent('ue_textchange')
  95. RETURN 1
  96. end function
  97. on w_publ_edit_choice.create
  98. int iCurrent
  99. call super::create
  100. this.cb_add=create cb_add
  101. this.cb_edit=create cb_edit
  102. this.cb_delet=create cb_delet
  103. this.cb_choice=create cb_choice
  104. this.dw_uc=create dw_uc
  105. this.cb_rtr=create cb_rtr
  106. this.cb_help=create cb_help
  107. this.ln_bar=create ln_bar
  108. this.ln_bar2=create ln_bar2
  109. this.r_bar=create r_bar
  110. iCurrent=UpperBound(this.Control)
  111. this.Control[iCurrent+1]=this.cb_add
  112. this.Control[iCurrent+2]=this.cb_edit
  113. this.Control[iCurrent+3]=this.cb_delet
  114. this.Control[iCurrent+4]=this.cb_choice
  115. this.Control[iCurrent+5]=this.dw_uc
  116. this.Control[iCurrent+6]=this.cb_rtr
  117. this.Control[iCurrent+7]=this.cb_help
  118. this.Control[iCurrent+8]=this.ln_bar
  119. this.Control[iCurrent+9]=this.ln_bar2
  120. this.Control[iCurrent+10]=this.r_bar
  121. end on
  122. on w_publ_edit_choice.destroy
  123. call super::destroy
  124. destroy(this.cb_add)
  125. destroy(this.cb_edit)
  126. destroy(this.cb_delet)
  127. destroy(this.cb_choice)
  128. destroy(this.dw_uc)
  129. destroy(this.cb_rtr)
  130. destroy(this.cb_help)
  131. destroy(this.ln_bar)
  132. destroy(this.ln_bar2)
  133. destroy(this.r_bar)
  134. end on
  135. event ue_filter;call super::ue_filter;//OPENWITHPARM(w_filter_query,dw_uc)
  136. //STRING LS_EXPR
  137. //LS_EXPR=Message.StringParm
  138. //
  139. //if len(LS_EXPR)>2 and trim(LS_EXPR)='' then return
  140. //
  141. //dw_uc.setfilter(LS_EXPR)
  142. //
  143. //dw_uc.SetRedraw (false)
  144. //dw_uc.filter()
  145. //dw_uc.SetRedraw (true)
  146. end event
  147. event closequery;call super::closequery;IF dw_edit_mode THEN
  148. dw_UC.AcceptText()
  149. Int ls_row = 0
  150. ls_row = dw_UC.GetNextModified(0, Primary!)+&
  151. dw_UC.GetNextModified(0, Filter!)+dw_UC.DeletedCount()
  152. IF ls_row > 0 THEN
  153. IF MessageBox('是否保存','数据已经改变,是否放弃保存?',Question!,YesNo!,1 ) = 2 THEN
  154. RETURN 1
  155. END IF
  156. END IF
  157. END IF
  158. end event
  159. event open;call super::open;dw_UC.SetTransObject (sqlca)
  160. this.triggerevent('retrieve_uc')
  161. end event
  162. event resize;call super::resize;ln_bar.endx = this.width
  163. ln_bar2.endx = this.width
  164. r_bar.width = this.width
  165. end event
  166. event key;call super::key;this.triggerevent('user_key')
  167. end event
  168. type cb_func from w_publ_base`cb_func within w_publ_edit_choice
  169. integer x = 151
  170. integer width = 151
  171. integer height = 164
  172. string normalpicname = "setting.bmp"
  173. integer picsize = 16
  174. toolbaralignment pic_align = alignattop!
  175. boolean border = false
  176. end type
  177. type cb_exit from w_publ_base`cb_exit within w_publ_edit_choice
  178. integer x = 1138
  179. integer width = 151
  180. integer height = 164
  181. integer picsize = 16
  182. toolbaralignment pic_align = alignattop!
  183. boolean border = false
  184. end type
  185. type cb_add from uo_imflatbutton within w_publ_edit_choice
  186. integer x = 302
  187. integer width = 192
  188. integer height = 164
  189. integer taborder = 20
  190. boolean bringtotop = true
  191. string text = "新建&S"
  192. string normalpicname = "new.bmp"
  193. integer picsize = 16
  194. toolbaralignment pic_align = alignattop!
  195. boolean border = false
  196. end type
  197. event clicked;call super::clicked;//long ll_newid,i
  198. //string errmsg
  199. //IF dw_edit_mode THEN
  200. // dw_uc.accepttext()
  201. // if dw_uc.GetNextModified(0, Primary!)=0 then
  202. // MESSAGEBOX(publ_operator,'没有任何修改,不可以保存!')
  203. // RETURN
  204. // end if
  205. // DW_UC.OBJECT.departmentname[DW_UC.GETROW()]=TRIM(DW_UC.OBJECT.departmentname[DW_UC.GETROW()])
  206. //
  207. //
  208. // IF DW_UC.OBJECT.departmentname[DW_UC.GETROW()]='' THEN
  209. // MESSAGEBOX(publ_operator,'请输入部门资料名称!')
  210. // RETURN
  211. // END IF
  212. //
  213. // if dw_uc.object.departmentid[dw_uc.getrow()]=0 then
  214. // ll_newid=f_sys_scidentity(0,"cw_department","departmentid",errmsg,false)
  215. // if ll_newid<=0 then
  216. // messagebox(publ_operator,errmsg)
  217. // return
  218. // else
  219. // dw_uc.object.departmentid[DW_UC.GETROW()]=ll_newid
  220. // end if
  221. // end if
  222. //end if
  223. //
  224. //
  225. //
  226. //IF dw_edit_mode THEN
  227. // string ls_errmsg
  228. // if dw_UC.Update() = -1 then
  229. // if pos(ins_sqlerrtext,"Cannot insert duplicate key row")>0 then
  230. // ls_errmsg="关键内容重复"
  231. // else
  232. // ls_errmsg="因为网络或其他原因>"+ins_sqlerrtext
  233. // end if
  234. // rollback;
  235. // MessageBox (publ_operator,ls_errmsg+",保存操作失败!",Exclamation!,OK!)
  236. // LS_UPDATE_FLAG=FALSE
  237. // RETURN
  238. // else
  239. // commit;
  240. // for i=1 to 3
  241. // dw_UC.SetTabOrder ( i, 0 )
  242. // next
  243. // LS_UPDATE_FLAG=TRUE
  244. // end if
  245. // ins_sqlerrtext=""
  246. //ELSE
  247. // long li_row, li_cur_row
  248. // li_cur_row = dw_UC.GetRow()
  249. // li_row = dw_UC.InsertRow (0)
  250. // for i=1 to 3
  251. // dw_UC.SetTabOrder ( i, i*10 )
  252. // next
  253. // dw_uc.selectrow(0,false)
  254. // dw_UC.ScrollToRow (li_row)
  255. // dw_uc.selectrow(li_row,true)
  256. // dw_UC.SetFocus()
  257. // modifyrow_no= li_row
  258. //END IF
  259. //
  260. //dw_edit_mode= NOT dw_edit_mode
  261. //WF_FACE_CHANGE()
  262. //
  263. end event
  264. type cb_edit from uo_imflatbutton within w_publ_edit_choice
  265. integer x = 494
  266. integer width = 192
  267. integer height = 164
  268. integer taborder = 30
  269. boolean bringtotop = true
  270. string text = "修改&E"
  271. string normalpicname = "open.bmp"
  272. integer picsize = 16
  273. toolbaralignment pic_align = alignattop!
  274. boolean border = false
  275. end type
  276. event clicked;call super::clicked;//long i
  277. //IF dw_edit_mode THEN
  278. // if dw_uc.GetItemStatus(dw_UC.getrow(), 0, Primary!)=NewModified! or dw_uc.GetItemStatus(dw_UC.getrow(), 0, Primary!)=New! then
  279. // dw_UC.deleterow(dw_UC.getrow())
  280. // else
  281. // dw_UC.ReselectRow(dw_UC.getrow())
  282. // end if
  283. // for i=1 to 3
  284. // dw_UC.SetTabOrder ( i, 0 )
  285. // next
  286. // modifyrow_no = 0
  287. //ELSE
  288. // modifyrow_no = dw_UC.getrow()
  289. // for i=1 to 3
  290. // dw_UC.SetTabOrder ( i, i*10 )
  291. // next
  292. // dw_UC.SetFocus()
  293. //
  294. // dw_UC.selectrow(0,false)
  295. // dw_UC.ScrollToRow (modifyrow_no)
  296. // dw_uc.selectrow(modifyrow_no,true)
  297. //
  298. //END IF
  299. //
  300. //dw_edit_mode= NOT dw_edit_mode
  301. //WF_FACE_CHANGE()
  302. end event
  303. type cb_delet from uo_imflatbutton within w_publ_edit_choice
  304. integer x = 686
  305. integer width = 151
  306. integer height = 164
  307. integer taborder = 40
  308. boolean bringtotop = true
  309. string text = "删除"
  310. string normalpicname = "delete.bmp"
  311. integer picsize = 16
  312. toolbaralignment pic_align = alignattop!
  313. boolean border = false
  314. end type
  315. event clicked;call super::clicked;//IF MessageBox (publ_operator,"是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
  316. //RETURN
  317. //END IF
  318. //
  319. //long LS_id
  320. //LONG LS_LONG=0
  321. //string ls_code,arg_msg
  322. //IF DW_UC.GETROW()<=0 THEN
  323. // MESSAGEBOX('','没有操作目标记录!')
  324. // RETURN
  325. //END IF
  326. //LS_id=DW_UC.OBJECT.departmentid[DW_UC.GETROW()]
  327. //select COUNT(*) into :LS_LONG from u_rs_empinfo
  328. // where u_rs_empinfo.deptid=:LS_id ;
  329. //if SQLCA.SQLCode<>0 then
  330. // MessageBox (publ_operator,"数据查询操作失败!(请重试!)",Exclamation!,OK!)
  331. // return
  332. //end if
  333. //IF LS_LONG>0 THEN
  334. // MessageBox (publ_operator,"该资料已经使用于人事资料,不可以删除!",Exclamation!,OK!)
  335. // RETURN
  336. //END IF
  337. //
  338. //LS_LONG=0
  339. //select COUNT(*) into :LS_LONG from u_sc_workgroup
  340. // where u_sc_workgroup.deptid=:LS_id ;
  341. //if SQLCA.SQLCode<>0 then
  342. // MessageBox (publ_operator,"数据查询操作失败!(请重试!)",Exclamation!,OK!)
  343. // return
  344. //end if
  345. //IF LS_LONG>0 THEN
  346. // MessageBox (publ_operator,"该资料已经使用于工组设定中,不可以删除!",Exclamation!,OK!)
  347. // RETURN
  348. //END IF
  349. //
  350. //dw_uc.SetRedraw (false)
  351. //dw_UC.DeleteRow (0)
  352. //dw_UC.TriggerEvent (rowfocuschanged!)
  353. //
  354. //if dw_UC.Update() = -1 then
  355. // rollback;
  356. // MessageBox (publ_operator,"删除记录操作失败!",Exclamation!,OK!)
  357. //else
  358. // commit;
  359. //end if
  360. //dw_uc.SetRedraw (true)
  361. end event
  362. type cb_choice from uo_imflatbutton within w_publ_edit_choice
  363. integer x = 837
  364. integer width = 151
  365. integer height = 164
  366. integer taborder = 50
  367. boolean bringtotop = true
  368. string text = "选定"
  369. string normalpicname = "ok.bmp"
  370. integer picsize = 16
  371. toolbaralignment pic_align = alignattop!
  372. boolean border = false
  373. end type
  374. type dw_uc from u_dw_rbtnfilter within w_publ_edit_choice
  375. integer y = 176
  376. integer width = 1993
  377. integer height = 1268
  378. integer taborder = 20
  379. boolean bringtotop = true
  380. boolean vscrollbar = true
  381. end type
  382. event dberror;call super::dberror;ins_sqlerrtext=sqlerrtext
  383. return 1
  384. end event
  385. event rowfocuschanged;call super::rowfocuschanged;IF modifyrow_no >0 AND dw_edit_mode THEN
  386. THIS.SETROW(modifyrow_no)
  387. THIS.ScrollToRow(modifyrow_no)
  388. else
  389. this.selectrow(0,false)
  390. this.selectrow(currentrow,true)
  391. END IF
  392. end event
  393. event rowfocuschanging;call super::rowfocuschanging;if dw_edit_mode then return 1
  394. end event
  395. event constructor;call super::constructor; titleclick_sort_use=true //单击标题排序-功能开关
  396. RBUTTON_FILTER_USE=true //右键查询-功能开关
  397. setcolumn_visible_USE= true //自动保存显示列-功能开关
  398. autosave_setlayout_USE= true //自动保存列位置及宽度-功能开关
  399. end event
  400. event rbuttondown;IF dw_edit_mode THEN RETURN 1
  401. CALL SUPER::RButtonDown
  402. end event
  403. event retrieveend;call super::retrieveend;IF RowCount > 0 THEN
  404. dw_uc.SelectRow(0,FALSE)
  405. dw_uc.SetRow(1)
  406. dw_uc.SelectRow(1,TRUE)
  407. END IF
  408. end event
  409. event dwnkey;call super::dwnkey;parent.triggerevent('user_key')
  410. //IF dw_edit_mode THEN
  411. // IF KeyDown(keydownarrow!) THEN
  412. // IF THIS.GetRow() = THIS.RowCount() THEN
  413. // PARENT.TriggerEvent('insert_childrow')
  414. // END IF
  415. // ELSE
  416. // IF KeyDown(keyenter!) AND NOT KeyDown(keycontrol!) AND NOT KeyDown(keyshift!) THEN
  417. // IF THIS.GetColumnName( ) = 'locacode' AND THIS.GetRow() = THIS.RowCount() THEN
  418. // PARENT.TriggerEvent("insert_childrow")
  419. // RETURN 1
  420. // END IF
  421. // ELSE
  422. // IF Key = keyenter! THEN
  423. // keybd_event ( 9, 0, 0 , 0 ) // 按下tab
  424. // keybd_event ( 9, 0, 2, 0 ) // 释放tab
  425. // RETURN 1
  426. // END IF
  427. // END IF
  428. // END IF
  429. //
  430. //end if
  431. end event
  432. type cb_rtr from uo_imflatbutton within w_publ_edit_choice
  433. integer width = 151
  434. integer height = 164
  435. integer taborder = 20
  436. boolean bringtotop = true
  437. string text = "刷新"
  438. string normalpicname = "refresh.bmp"
  439. integer picsize = 16
  440. toolbaralignment pic_align = alignattop!
  441. boolean border = false
  442. end type
  443. event clicked;call super::clicked;parent.triggerevent('retrieve_uc')
  444. end event
  445. type cb_help from uo_imflatbutton within w_publ_edit_choice
  446. integer x = 987
  447. integer width = 151
  448. integer height = 164
  449. integer taborder = 20
  450. boolean bringtotop = true
  451. string text = "帮助"
  452. string normalpicname = "help.bmp"
  453. integer picsize = 16
  454. toolbaralignment pic_align = alignattop!
  455. boolean border = false
  456. end type
  457. event clicked;call super::clicked;PARENT.TriggerEvent('ue_help')
  458. end event
  459. type ln_bar from line within w_publ_edit_choice
  460. long linecolor = 268435456
  461. integer linethickness = 4
  462. integer beginy = 168
  463. integer endx = 1481
  464. integer endy = 168
  465. end type
  466. type ln_bar2 from line within w_publ_edit_choice
  467. long linecolor = 16777215
  468. integer linethickness = 4
  469. integer beginy = 172
  470. integer endx = 1513
  471. integer endy = 172
  472. end type
  473. type r_bar from rectangle within w_publ_edit_choice
  474. long linecolor = 16777215
  475. integer linethickness = 4
  476. long fillcolor = 1073741824
  477. integer x = 1257
  478. integer width = 146
  479. integer height = 68
  480. end type
  481. event constructor;this.fillcolor = 14215660
  482. this.linecolor = 14215660
  483. this.x = -1
  484. this.y = -1
  485. this.height = ln_bar.beginy - 5
  486. end event