当前位置: 代码迷 >> PB >> 追问,tooltips功能的实现,该怎么处理
  详细解决方案

追问,tooltips功能的实现,该怎么处理

热度:1008   发布时间:2016-04-29 10:42:13.0
追问,tooltips功能的实现
当鼠标移动到此单行编辑框时,文本框的内容为单行编辑框中的完整信息;当鼠标移开后,显示完整信息的文本框消失。


当前所实现的效果是静态的,现在想要改进一下:1.达到动态的获取文本框里的内容;
2.是否可以判断一下,文本框显示的长度与所要显示的内容的长度是否足够显示内容,如果足够,则不显示tooltips,反之,显示。



非常感谢各位高手不吝赐教。

------解决方案--------------------
给你发个对象
------解决方案--------------------
保存为 uo_singlelineedit.sru
然后导入

C/C++ code
$PBExportHeader$uo_singlelineedit.sruforwardglobal type uo_singlelineedit from singlelineeditend typeend forwardglobal type uo_singlelineedit from singlelineeditinteger width = 457integer height = 128integer textsize = -9integer weight = 400fontcharset fontcharset = ansi!fontpitch fontpitch = variable!fontfamily fontfamily = swiss!string facename = "宋体"long textcolor = 33554432string text = "none"borderstyle borderstyle = stylelowered!event ue_mousemove pbm_mousemoveevent ue_change pbm_enchangeend typeglobal uo_singlelineedit uo_singlelineedittype variablespublic:integer tipicon = 0 //提示框显示的图标:TTI_NONE=0,TTI_INFO=1,TTI_WARNING=2,TTI_ERROR=3string tiptitle = '' //提示框显示的标题rowfocusind Tooltiptype = hand! //提示框显示类型:hand! 为气泡型提示框, focusrect! 为方框型提示框, off!为不显示private:nvo_tooltips invo_tooltipint i_uidboolean ib_enchangedend variablesforward prototypespublic subroutine of_resettip ()end prototypesevent ue_mousemove;if ib_enchanged then     of_resettip()    ib_enchanged = falseend ifinvo_tooltip.of_relaymsg( this, 512) //512代表鼠标移动是显示tooltipend eventevent ue_change;ib_enchanged = trueend eventpublic subroutine of_resettip ();if i_uid > 0 then invo_tooltip.of_remotetool(this, i_uid)invo_tooltip.of_set_tippro( tipicon, tiptitle, TOOLTIPTYPE)i_uid = invo_tooltip.of_addtool( this, this.text, 0) //以控件的text属性为tip内容end subroutineon uo_singlelineedit.createend onon uo_singlelineedit.destroyend onevent constructor;of_resettip()end event
------解决方案--------------------
2、在窗口上放置一个mle控件,将mle控件的字体设置成与sle一样,同时控件宽度和文本也设置为一样
然后判断mle_1.linecount() ,当大于1时,表示超过需要显示tooltip,反之则未超过