当鼠标移动到此单行编辑框时,文本框的内容为单行编辑框中的完整信息;当鼠标移开后,显示完整信息的文本框消失。
当前所实现的效果是静态的,现在想要改进一下:1.达到动态的获取文本框里的内容;
2.是否可以判断一下,文本框显示的长度与所要显示的内容的长度是否足够显示内容,如果足够,则不显示tooltips,反之,显示。
非常感谢各位高手不吝赐教。
------解决方案--------------------
给你发个对象
------解决方案--------------------
保存为 uo_singlelineedit.sru
然后导入
- C/C++ code
$PBExportHeader$uo_singlelineedit.sru forward global type uo_singlelineedit from singlelineedit end type end forward global type uo_singlelineedit from singlelineedit integer width = 457 integer height = 128 integer textsize = -9 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "宋体" long textcolor = 33554432 string text = "none" borderstyle borderstyle = stylelowered! event ue_mousemove pbm_mousemove event ue_change pbm_enchange end type global uo_singlelineedit uo_singlelineedit type variables public: integer tipicon = 0 //提示框显示的图标:TTI_NONE=0,TTI_INFO=1,TTI_WARNING=2,TTI_ERROR=3 string tiptitle = '' //提示框显示的标题 rowfocusind Tooltiptype = hand! //提示框显示类型:hand! 为气泡型提示框, focusrect! 为方框型提示框, off!为不显示 private: nvo_tooltips invo_tooltip int i_uid boolean ib_enchanged end variables forward prototypes public subroutine of_resettip () end prototypes event ue_mousemove;if ib_enchanged then of_resettip() ib_enchanged = false end if invo_tooltip.of_relaymsg( this, 512) //512代表鼠标移动是显示tooltip end event event ue_change;ib_enchanged = true end event public 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 subroutine on uo_singlelineedit.create end on on uo_singlelineedit.destroy end on event constructor;of_resettip() end event
------解决方案--------------------
2、在窗口上放置一个mle控件,将mle控件的字体设置成与sle一样,同时控件宽度和文本也设置为一样
然后判断mle_1.linecount() ,当大于1时,表示超过需要显示tooltip,反之则未超过