|
-
Jan 22nd, 2010, 02:42 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Don't want to show tooltip when over Vscrollbar
I have successfully created a tooltip using TOOLINFO structure, and changed its time on, changed the title, changed the text, using SendMessage and the proper TTMs. However I do not want the tooltip to popup when over the control's Vscrollbar. I played around with TOOLINFO.rc values, but when I do, the tooltip won't pop up at all. What am I doing wrong?
.rc.right = listbox.width
.rc.left = listbox.left
.rc.top = listbox.top
.rc.bottom = listbox.height
.uflags = TTF_SUBCLASS
TTM_GETTEXTA = Wm_User + 11
Public Type
cbsize as long
uFlags as Long
hwnd as long
uID as long
rc as RECT
hInstance as Long
lpszText as String
lParam as long
End Type
Dim parentHwnd as long 'handle of the control I want the tooltip to trigger over
Dim tipHwnd as Long 'returned from CreateWindow(tooltip setup styles)
-
Jan 22nd, 2010, 03:45 PM
#2
Re: Don't want to show tooltip when over Vscrollbar
For .RC: The bounding rectangle coordinates of the tool. The coordinates are relative to the upper-left corner of the client area of the window identified by hWnd. In pixels not twips.
So, if hWnd is the listbox's hWnd, you will want to call GetClientRect API on that hWnd. But that probably includes the scrollbar too. So you will have to subtract the scrollbar's width if it has a scrollbar. GetWindowLong API and checking if WS_VScroll style is used should tell you if scrollbar is visible or not. To get the width of a standard scrollbar, use GetSystemMetrics API with SM_CXVSCROLL
Code:
Private Const GWL_STYLE As Long = -16
Private Const WS_VSCROLL As Long = &H200000
Private Const SM_CXVSCROLL As Long = &H2
"Air Code" follows - typing from memory
Code:
GetClientRect listbox.hWnd, ttm.RC
If (GetWindowLong(listbox.hWnd, GWL_Style) And WS_VScroll) Then ' vscroll visible
ttm.RC.Right = ttm.RC.Right - GetSystemMetrics(SM_CXVSCROLL)
End If
Last edited by LaVolpe; Jan 22nd, 2010 at 04:20 PM.
Reason: added Air Code
-
Jan 23rd, 2010, 01:02 AM
#3
Thread Starter
Addicted Member
Re: Don't want to show tooltip when over Vscrollbar
LaVolpe,
Turns out the call to GetSystemMetrics wasn't necessary, just the call to GetClientRect. I switched to using a MSHFlexgrid, the scrollbars werent included in the client area.
Thank you!
Others,
use TTF_SUBCLASS OR TTF_IDISHWND flag to ignore the client area .rc in the TOOL_INFO structure.
Last edited by vb_lover; Jan 23rd, 2010 at 02:28 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|