w_fx_ip_setting.srw 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. $PBExportHeader$w_fx_ip_setting.srw
  2. forward
  3. global type w_fx_ip_setting from window
  4. end type
  5. type st_1 from statictext within w_fx_ip_setting
  6. end type
  7. type cb_back from commandbutton within w_fx_ip_setting
  8. end type
  9. type cb_del from commandbutton within w_fx_ip_setting
  10. end type
  11. type dw_1 from datawindow within w_fx_ip_setting
  12. end type
  13. end forward
  14. global type w_fx_ip_setting from window
  15. integer width = 1152
  16. integer height = 804
  17. windowtype windowtype = response!
  18. long backcolor = 16777215
  19. string icon = "AppIcon!"
  20. st_1 st_1
  21. cb_back cb_back
  22. cb_del cb_del
  23. dw_1 dw_1
  24. end type
  25. global w_fx_ip_setting w_fx_ip_setting
  26. type variables
  27. s_fx_ip_setting ins_parm, ins_empty
  28. end variables
  29. forward prototypes
  30. public function integer wf_retrieve ()
  31. public function integer wf_save ()
  32. end prototypes
  33. public function integer wf_retrieve ();int rslt = 1
  34. long i, insertRow
  35. string temp_ip
  36. dw_1.Reset()
  37. dw_1.SetRedraw(false)
  38. for i = 1 to 9
  39. temp_ip = Trim(ProfileString(sys_fx_ini, 'server_' + string(i), 'ip', ''))
  40. if (temp_ip = '') then continue
  41. insertRow = dw_1.InsertRow(0)
  42. dw_1.Object.ip[insertRow] = temp_ip
  43. dw_1.Object.port[insertRow] = ProfileInt(sys_fx_ini, 'server_' + string(i), 'port', 0)
  44. dw_1.Object.name[insertRow] = Trim(ProfileString(sys_fx_ini, 'server_' + string(i), 'name', ''))
  45. dw_1.Object.printid[insertRow] = i
  46. next
  47. dw_1.AcceptText()
  48. dw_1.SetRedraw(true)
  49. return rslt
  50. end function
  51. public function integer wf_save ();int rslt = 1
  52. long i, cnt = 0
  53. string temp_ip, temp_name
  54. long temp_port
  55. dw_1.AcceptText()
  56. for i = 1 to dw_1.RowCount()
  57. cnt++
  58. //SetProfileString
  59. temp_ip = Trim(dw_1.Object.ip[i])
  60. temp_port = dw_1.Object.port[i]
  61. temp_name = Trim(dw_1.Object.name[i])
  62. SetProfileString(sys_fx_ini, 'server_' + string(i), 'ip', temp_ip)
  63. SetProfileString(sys_fx_ini, 'server_' + string(i), 'port', string(temp_port))
  64. SetProfileString(sys_fx_ini, 'server_' + string(i), 'name', temp_name)
  65. next
  66. if (cnt < 9) then
  67. for i = cnt + 1 to 9
  68. SetProfileString(sys_fx_ini, 'server_' + string(i), 'ip', '')
  69. SetProfileString(sys_fx_ini, 'server_' + string(i), 'port', '')
  70. SetProfileString(sys_fx_ini, 'server_' + string(i), 'name', '')
  71. next
  72. end if
  73. return rslt
  74. end function
  75. on w_fx_ip_setting.create
  76. this.st_1=create st_1
  77. this.cb_back=create cb_back
  78. this.cb_del=create cb_del
  79. this.dw_1=create dw_1
  80. this.Control[]={this.st_1,&
  81. this.cb_back,&
  82. this.cb_del,&
  83. this.dw_1}
  84. end on
  85. on w_fx_ip_setting.destroy
  86. destroy(this.st_1)
  87. destroy(this.cb_back)
  88. destroy(this.cb_del)
  89. destroy(this.dw_1)
  90. end on
  91. event open;ins_parm = Message.PowerObjectParm
  92. if (IsNull(ins_parm)) then
  93. Close(this)
  94. return
  95. end if
  96. if (not IsValid(ins_parm)) then
  97. Close(this)
  98. return
  99. end if
  100. this.X = ins_parm.x
  101. this.Y = ins_parm.y
  102. wf_retrieve()
  103. end event
  104. event close;wf_save()
  105. CLoseWithReturn(this, ins_parm)
  106. end event
  107. type st_1 from statictext within w_fx_ip_setting
  108. integer x = 50
  109. integer y = 708
  110. integer width = 507
  111. integer height = 48
  112. integer textsize = -9
  113. integer weight = 400
  114. fontcharset fontcharset = gb2312charset!
  115. fontpitch fontpitch = variable!
  116. string facename = "宋体"
  117. long textcolor = 16711680
  118. long backcolor = 16777215
  119. string text = "双击列表项进行选择"
  120. boolean focusrectangle = false
  121. end type
  122. type cb_back from commandbutton within w_fx_ip_setting
  123. integer x = 914
  124. integer y = 688
  125. integer width = 210
  126. integer height = 88
  127. integer taborder = 20
  128. integer textsize = -9
  129. integer weight = 400
  130. fontcharset fontcharset = gb2312charset!
  131. fontpitch fontpitch = variable!
  132. string facename = "宋体"
  133. string text = "返回"
  134. boolean cancel = true
  135. end type
  136. event clicked;ins_parm = ins_empty
  137. Close(parent)
  138. end event
  139. type cb_del from commandbutton within w_fx_ip_setting
  140. integer x = 622
  141. integer y = 688
  142. integer width = 210
  143. integer height = 88
  144. integer taborder = 20
  145. integer textsize = -9
  146. integer weight = 400
  147. fontcharset fontcharset = gb2312charset!
  148. fontpitch fontpitch = variable!
  149. string facename = "宋体"
  150. string text = "删除"
  151. end type
  152. event clicked;long row
  153. row = dw_1.GetRow()
  154. if (row > 0) then
  155. if (dw_1.IsSelected(row)) then
  156. dw_1.DeleteRow(row)
  157. if (dw_1.RowCount() >= row) then
  158. dw_1.SelectRow(0, false)
  159. dw_1.SelectRow(row, true)
  160. dw_1.SetRow(row)
  161. elseif (dw_1.RowCount() > 0) then
  162. row = dw_1.RowCount()
  163. dw_1.SelectRow(0, false)
  164. dw_1.SelectRow(row, true)
  165. dw_1.SetRow(row)
  166. end if
  167. end if
  168. end if
  169. end event
  170. type dw_1 from datawindow within w_fx_ip_setting
  171. integer width = 1143
  172. integer height = 680
  173. integer taborder = 10
  174. string title = "none"
  175. string dataobject = "dw_fx_ip_setting"
  176. boolean hscrollbar = true
  177. boolean vscrollbar = true
  178. boolean livescroll = true
  179. borderstyle borderstyle = stylelowered!
  180. end type
  181. event doubleclicked;if (row > 0) then
  182. ins_parm.ip = Trim(this.Object.ip[row])
  183. ins_parm.port = this.Object.port[row]
  184. Close(parent)
  185. end if
  186. end event
  187. event clicked;if (row > 0) then
  188. this.SelectRow(0, false)
  189. this.SelectRow(row, true)
  190. this.SetRow(row)
  191. end if
  192. end event
  193. event rowfocuschanged;if (currentrow > 0) then
  194. this.SelectRow(0, false)
  195. this.SelectRow(currentrow, true)
  196. this.SetRow(currentrow)
  197. end if
  198. end event