当前位置: 代码迷 >> PB >> tooltip 在数据窗口中的用法,该如何处理
  详细解决方案

tooltip 在数据窗口中的用法,该如何处理

热度:406   发布时间:2016-04-29 06:26:26.0
tooltip 在数据窗口中的用法
Long  ii_dwID

inv_Tooltip.of_SetMaxWidth( 1500 )
inv_Tooltip.of_SetTipTitle( inv_Tooltip.TTI_INFO, ls_Roomno )
ii_dwID = inv_ToolTip.of_AddTool(dw_4, "" , 0 ) 


inv_Tooltip.of_SettipText( This, ii_dwID, '测试aaa' )

我在Clicked 或者 自定义 pbm_mousemove 事件.当我点一下的时候不会弹出信息.总是要再移动一下鼠标才能弹出信息出来
 
------解决方案--------------------
看一下你的of_setiptext是怎么写的?

或者单步跟踪一下

如果你用的是pb11以上的版本,数据窗口的列有tip属性,设置即可
------解决方案--------------------
有数据窗口tip示例,如果需要可发至邮箱





------解决方案--------------------
forward
global type n_cst_dwsrv_autohint from nonvisualobject
end type
type logfont from structure within n_cst_dwsrv_autohint
end type
type textsize from structure within n_cst_dwsrv_autohint
end type
end forward

type logfont from structure
long lfHeight
long lfWidth
long lfEscapement
long lfOrientation
long lfWeight
character lfItalic
character lfUnderline
character lfStrikeOut
character lfCharSet
character lfOutPrecision
character lfClipPrecision
character lfQuality
character lfPitchAndFamily
string lfFaceName
end type

type textsize from structure
long l_cx
long l_cy
end type

global type n_cst_dwsrv_autohint from nonvisualobject
event type long ue_mousemove ( unsignedlong flags,  integer xpos,  integer ypos )
event type long resize ( unsignedlong sizetype,  integer newwidth,  integer newheight )
end type
global n_cst_dwsrv_autohint n_cst_dwsrv_autohint

type prototypes
FUNCTION ulong GetDC(ulong hwnd) LIBRARY "user32.dll"
FUNCTION ulong ReleaseDC(ulong hwnd,ulong hdc) LIBRARY "user32.dll"
FUNCTION ulong SelectObject(ulong hdc,ulong hObject) LIBRARY "gdi32.dll"
FUNCTION ulong DeleteObject(ulong hObject) LIBRARY "gdi32.dll"
FUNCTION ulong CreateFontIndirect(ref LOGFONT lpLogFont) LIBRARY "gdi32.dll" ALIAS FOR "CreateFontIndirectA"
FUNCTION ulong GetTextExtentExPoint(ulong hdc,ref string lpszStr,ulong cchString,ulong nMaxExtent,ref ulong lpnFit,ref ulong alpDx,ref textSIZE lpSize) LIBRARY "gdi32.dll" ALIAS FOR "GetTextExtentExPointA"
FUNCTION ulong GetTextExtentPoint32(ulong hdc,ref string lpsz,ulong cbString,ref textSIZE lpSize) LIBRARY "gdi32.dll" ALIAS FOR "GetTextExtentPoint32A"
Function long MulDiv (long nNumber, long nNumerator, long nDenominator) Library  "KERNEL32.DLL"
FUNCTION ulong GetDeviceCaps(ulong hdc,ulong nIndex) LIBRARY "gdi32.dll"

end prototypes

type variables
Private:
DataWindow idw_requestor
nvo_tooltips ToolTip
String is_prior_dwo

end variables

forward prototypes
public function long of_gettextwidth (string as_colname, string as_text)
public subroutine of_replacestring (ref string as_src, string as_oldstr, string as_newstr)
public function integer of_setrequestor (datawindow adw_requestor)
end prototypes

event type long ue_mousemove(unsignedlong flags, integer xpos, integer ypos);String ls_dwo,ls_col,ls_text
Long ll_row
Int li_pos


ls_dwo = idw_requestor.GetObjectAtPointer()

If is_prior_dwo = ls_dwo Then
Return 0
Else
is_prior_dwo = ls_dwo
End If

If Tooltip.tipvisible() or flags <> 0 Then 
Tooltip.hidetip(idw_requestor)
end if

li_pos = Pos(ls_dwo, "~t")
If li_pos <= 0 Then Return 0


ls_col = Left (ls_dwo, li_pos - 1 )
ll_row = Long(Mid(ls_dwo,li_pos + 1 ))


If idw_requestor.Describe(ls_col+".Type") <> "column" Then  Return 0 //不是列对象


Long ll_width,ll_needWidth,ll_x
String ls_editSty
ll_width = Long(idw_requestor.Describe(ls_col+".Width"))
ll_x = Long(idw_requestor.Describe(ls_col+".x"))
ls_editSty = idw_requestor.Describe(ls_col+".Edit.Style")

If ls_editSty = "editmask" Then //有掩码
Int li_colNum
String ls_mask
li_colNum = Integer(idw_requestor.Describe(ls_col+".ID"))
ls_mask = idw_requestor.Describe(ls_col+".EditMask.Mask")
If Left(idw_requestor.Describe(ls_col+".Coltype"),4) = "char" Then //字符型掩码
//字符可以转化为数字(直接用string(s,"##")得不到)
of_replaceString(ls_mask,"#","@")
ls_text = String(idw_requestor.Object.Data[ll_row,li_colNum],ls_mask)
  相关解决方案