uo_button.sru 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. $PBExportHeader$uo_button.sru
  2. forward
  3. global type uo_button from userobject
  4. end type
  5. type pic from picture within uo_button
  6. end type
  7. type txt from statictext within uo_button
  8. end type
  9. type pb_1 from picturebutton within uo_button
  10. end type
  11. end forward
  12. global type uo_button from userobject
  13. integer width = 599
  14. integer height = 200
  15. long backcolor = 67108864
  16. string text = "none"
  17. long tabtextcolor = 33554432
  18. long picturemaskcolor = 536870912
  19. event helpedit ( )
  20. event clicked pbm_bnclicked
  21. event ue_settop ( )
  22. event ue_canceltop ( )
  23. pic pic
  24. txt txt
  25. pb_1 pb_1
  26. end type
  27. global uo_button uo_button
  28. type variables
  29. String picname
  30. string label
  31. string ins_msgid
  32. String menuevent
  33. window ins_parentwindow
  34. Boolean ins_istop
  35. end variables
  36. forward prototypes
  37. public function boolean uf_ifmenubutton ()
  38. end prototypes
  39. event helpedit();IF ins_msgid <> "" THEN
  40. s_kms_msg s_rslt
  41. s_rslt = kms_GetKMS_MSG(ins_msgid,"","","","","")
  42. IF s_rslt.doccode1 <> "" THEN
  43. kms_editdoc(s_rslt.doccode1)
  44. END IF
  45. END IF
  46. end event
  47. event clicked;IF uf_ifmenubutton() AND menuevent <> "" THEN
  48. w_menugroup lw_mg
  49. lw_mg = ins_parentwindow
  50. lw_mg.wf_handleevent(menuevent)
  51. END IF
  52. end event
  53. event ue_settop();IF uf_ifmenubutton() THEN
  54. w_menugroup lw_mg
  55. lw_mg = ins_parentwindow
  56. lw_mg.wf_settop(this)
  57. END IF
  58. end event
  59. event ue_canceltop();IF uf_ifmenubutton() THEN
  60. w_menugroup lw_mg
  61. lw_mg = ins_parentwindow
  62. lw_mg.wf_canceltop(this)
  63. END IF
  64. end event
  65. public function boolean uf_ifmenubutton ();IF IsValid(ins_parentwindow) AND NOT IsNull(ins_parentwindow) THEN
  66. IF ins_parentwindow.classname() = "w_menugroup" THEN
  67. RETURN TRUE
  68. END IF
  69. END IF
  70. RETURN false
  71. end function
  72. on uo_button.create
  73. this.pic=create pic
  74. this.txt=create txt
  75. this.pb_1=create pb_1
  76. this.Control[]={this.pic,&
  77. this.txt,&
  78. this.pb_1}
  79. end on
  80. on uo_button.destroy
  81. destroy(this.pic)
  82. destroy(this.txt)
  83. destroy(this.pb_1)
  84. end on
  85. event constructor;Int li_picmargin
  86. li_picmargin = 30
  87. pb_1.width = width
  88. pb_1.height = height
  89. pic.picturename = picname
  90. pic.Y = height / 4
  91. pic.X = li_picmargin + 16
  92. pic.height = height - 16*2
  93. pic.height = height / 2
  94. long ll_heightpx
  95. ll_heightpx = unitstopixels(pic.height, yunitstopixels!)
  96. pic.width = pixelstounits(ll_heightpx,xpixelstounits!)
  97. IF pic.picturename = "" THEN
  98. pic.visible = false
  99. END IF
  100. Int li_textpadding
  101. li_textpadding = 10
  102. txt.Text = label
  103. IF pic.visible THEN
  104. txt.X = pic.X+pic.width + li_picmargin
  105. ELSE
  106. txt.X = 16+li_textpadding
  107. END IF
  108. txt.width = width - txt.x - 16 - li_textpadding
  109. txt.Y = 16 + li_textpadding
  110. txt.height = height - txt.Y - 16 - li_textpadding
  111. end event
  112. event rbuttondown;IF ins_msgid <> "" THEN
  113. String ls_tooltips, ls_doccode
  114. s_kms_msg s_rslt
  115. s_rslt = kms_GetKMS_MSG(ins_msgid,"","","","","")
  116. ls_tooltips = s_rslt.msg
  117. ls_doccode = s_rslt.doccode1
  118. string ls_help, ls_helpedit
  119. IF ls_doccode <> "" THEN
  120. ls_help = "help"
  121. ls_helpedit = "helpedit"
  122. END IF
  123. String menustr
  124. IF ls_tooltips <> "" THEN
  125. IF menustr <> "" THEN menustr += "|"
  126. menustr+= "Text="+ls_tooltips+"~tEvent="
  127. END IF
  128. IF menustr <> "" THEN menustr += "|"
  129. menustr += "Text=帮助~tEvent="+ls_help+"~tParm=ControlEvent"
  130. //IF f_power_ind(6431,sys_msg_pow) THEN
  131. // IF menustr <> "" THEN menustr += "|"
  132. // menustr += "Text=编辑帮助~tEvent="+ls_helpedit+"~tParm=ControlEvent"
  133. //END IF
  134. END IF
  135. IF uf_ifmenubutton() THEN
  136. IF menustr <> "" THEN menustr += "|"
  137. IF ins_istop THEN
  138. menustr += "Text=取消置顶~tEvent=ue_canceltop"
  139. ELSE
  140. menustr += "Text=置顶~tEvent=ue_settop"
  141. END IF
  142. END IF
  143. If Len(Trim(menustr)) <> 0 Then
  144. m_Dfc_Control_PopupMenu dmPopupMenu
  145. dmPopupMenu = Create m_Dfc_Control_PopupMenu
  146. dmPopupMenu.mf_BuildMenu(This, menustr)
  147. IF IsValid(ins_parentwindow) THEN
  148. dmPopupMenu.mf_PopMenu(ins_parentwindow)
  149. ELSE
  150. dmPopupMenu.mf_PopMenu()
  151. END IF
  152. Destroy dmPopupMenu
  153. End If
  154. end event
  155. event help;IF ins_msgid <> "" THEN
  156. s_kms_msg s_rslt
  157. s_rslt = kms_GetKMS_MSG(ins_msgid,"","","","","")
  158. IF s_rslt.doccode1 <> "" THEN
  159. kms_showdoc(s_rslt.doccode1)
  160. END IF
  161. END IF
  162. end event
  163. type pic from picture within uo_button
  164. integer x = 18
  165. integer y = 16
  166. integer width = 201
  167. integer height = 168
  168. boolean focusrectangle = false
  169. end type
  170. event rbuttondown;parent.event post rbuttondown(flags,xpos,ypos)
  171. end event
  172. event clicked;parent.event post clicked()
  173. end event
  174. type txt from statictext within uo_button
  175. integer x = 215
  176. integer y = 16
  177. integer width = 370
  178. integer height = 168
  179. integer textsize = -9
  180. integer weight = 400
  181. fontcharset fontcharset = gb2312charset!
  182. fontpitch fontpitch = variable!
  183. string facename = "宋体"
  184. long textcolor = 33554432
  185. boolean focusrectangle = false
  186. end type
  187. event rbuttondown;parent.event post rbuttondown(flags,xpos,ypos)
  188. end event
  189. event clicked;parent.event post clicked()
  190. end event
  191. type pb_1 from picturebutton within uo_button
  192. integer width = 599
  193. integer height = 200
  194. integer taborder = 10
  195. integer textsize = -12
  196. integer weight = 400
  197. fontcharset fontcharset = ansi!
  198. fontpitch fontpitch = variable!
  199. fontfamily fontfamily = swiss!
  200. string facename = "Arial"
  201. boolean originalsize = true
  202. alignment htextalign = left!
  203. end type
  204. event rbuttondown;parent.event post rbuttondown(flags,xpos,ypos)
  205. end event
  206. event clicked;parent.event post clicked()
  207. end event