[RESOLVED] jcButton Balloon tooltips flicker when themed (manifest) applied
I found a hidden bug in MS tooltips class. If the toolstip set to TTS_BALLOON, the tooltips re-position (twice) in usercontrol only when themed (manifest) applied. But if the tooltips style is standard, the flicker goes off.
Please refer to my attachment. Compiled first. Run the exe file. Mouse moving over button from top to bottom, you can see balloon tooltips flickering. Is MS wrong or jcButton wrong?
I do think the original CreateToolTips function is ok. The problem is hidden. I haven't found the root cause.
Code:
Private Sub CreateToolTip()
'****************************************************************************
'* A very nice and flexible sub to create balloon tool tips
'* Author :- Fred.CPP
'* Added as requested by many users
'* Modified by me to support unicode
'* Thanks Alfredo ;)
'****************************************************************************
Dim lpRect As RECT
Dim lWinStyle As Long
Dim lPtr As Long
Dim ttip As TOOLINFO
Dim ttipW As TOOLINFOW
Const CS_DROPSHADOW As Long = &H20000
Const GCL_STYLE As Long = (-26)
' --Dont show tooltips if disabled
If (Not m_bEnabled) Or m_bPopupShown Or m_Buttonstate = eStateDown Then Exit Sub
' --Destroy any previous tooltip
If m_lttHwnd <> 0 Then
DestroyWindow m_lttHwnd
End If
lWinStyle = TTS_ALWAYSTIP Or TTS_NOPREFIX
''create baloon style if desired
If m_lTooltipType = TooltipBalloon Then lWinStyle = lWinStyle Or TTS_BALLOON
If m_bttRTL Then
m_lttHwnd = CreateWindowEx(WS_EX_LAYOUTRTL, TOOLTIPS_CLASSA, vbNullString, lWinStyle, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, UserControl.hWnd, 0&, App.hInstance, 0&)
Else
m_lttHwnd = CreateWindowEx(0&, TOOLTIPS_CLASSA, vbNullString, lWinStyle, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, UserControl.hWnd, 0&, App.hInstance, 0&)
End If
SetClassLong m_lttHwnd, GCL_STYLE, GetClassLong(m_lttHwnd, GCL_STYLE) Or CS_DROPSHADOW
'make our tooltip window a topmost window
' This is creating some problems as noted by K-Zero
'SetWindowPos m_lttHwnd, HWND_TOPMOST, 0&, 0&, 0&, 0&, SWP_NOACTIVATE Or SWP_NOSIZE Or SWP_NOMOVE
''get the rect of the parent control
GetClientRect UserControl.hWnd, lpRect
If m_WindowsNT Then
' --set our tooltip info structure for UNICODE SUPPORT >> WinNT
With ttipW
' --if we want it centered, then set that flag
If m_lttCentered Then
.lFlags = TTF_SUBCLASS Or TTF_CENTERTIP Or TTF_IDISHWND
Else
.lFlags = TTF_SUBCLASS Or TTF_IDISHWND
End If
' --set the hwnd prop to our parent control's hwnd
.lHwnd = UserControl.hWnd
.lId = hWnd
.lSize = Len(ttipW)
.hInstance = App.hInstance
.lpStrW = StrPtr(m_sTooltipText)
.lpRect = lpRect
End With
' --add the tooltip structure
SendMessage m_lttHwnd, TTM_ADDTOOLW, 0&, ttipW
Else
' --set our tooltip info structure for << WinNT
With ttip
''if we want it centered, then set that flag
If m_lttCentered Then
.lFlags = TTF_SUBCLASS Or TTF_CENTERTIP
Else
.lFlags = TTF_SUBCLASS
End If
' --set the hwnd prop to our parent control's hwnd
.lHwnd = UserControl.hWnd
.lId = hWnd
.lSize = Len(ttip)
.hInstance = App.hInstance
.lpStr = m_sTooltipText
.lpRect = lpRect
End With
' --add the tooltip structure
SendMessage m_lttHwnd, TTM_ADDTOOLA, 0&, ttip
End If
'if we want a title or we want an icon
If m_sTooltiptitle <> vbNullString Or m_lToolTipIcon <> TTNoIcon Then
If m_WindowsNT Then
lPtr = StrPtr(m_sTooltiptitle)
If lPtr Then
SendMessage m_lttHwnd, TTM_SETTITLEW, m_lToolTipIcon, ByVal lPtr
End If
Else
SendMessage m_lttHwnd, TTM_SETTITLE, CLng(m_lToolTipIcon), ByVal m_sTooltiptitle
End If
End If
SendMessage m_lttHwnd, TTM_SETMAXTIPWIDTH, 0, 240 'for Multiline capability
If m_lttBackColor <> Empty Then
SendMessage m_lttHwnd, TTM_SETTIPBKCOLOR, TranslateColor(m_lttBackColor), 0&
End If
End Sub
Last edited by Jonney; Jan 17th, 2013 at 12:50 AM.
Reason: add attachment
Re: jcButton Balloon tooltips flicker when themed (manifest) applied
I get the same glitch in XP even for standard style tooltips. But it's more of a slower blink than a flicker. Don't know if it has something to do with the double subclassing of the UserControl (self-subclass + TTF_SUBCLASS). Haven't pinpointed the root cause yet...
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Re: jcButton Balloon tooltips flicker when themed (manifest) applied
Originally Posted by Bonnie West
I get the same glitch in XP even for standard style tooltips. But it's more of a slower blink than a flicker. Don't know if it has something to do with the double subclassing of the UserControl (self-subclass + TTF_SUBCLASS). Haven't pinpointed the root cause yet...
The accurate say is that balloon tooltips is 'Re-positioned' when theme applied on Win7. Look like the balloon is just under mousepointer, so the balloon repositions again to leave small distance.
Re: jcButton Balloon tooltips flicker when themed (manifest) applied
In any case, it is a tooltip bug in jcButton. Not quite sure yet what it is...
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Re: jcButton Balloon tooltips flicker when themed (manifest) applied
Are you using Windows 7 ?
If so then try switching off all the Aero crap (etc).
If you don't wish to do a global switch off of Aero, then you can tell Win7 to just switch it off for your app.
If you right click your program's EXE and/or the shortcut to it, you can select Properties, and set the compatibility to XP, and also experiment with the 5 checkboxes in the middle of the dialog.
PLEASE NOTE You should first tick the checkbox down the bottom that says apply to all users, as that brings up another identical dialog that you should use instead.
Re: jcButton Balloon tooltips flicker when themed (manifest) applied
Originally Posted by Bobbles
Are you using Windows 7 ?
If so then try switching off all the Aero crap (etc).
If you don't wish to do a global switch off of Aero, then you can tell Win7 to just switch it off for your app.
If you right click your program's EXE and/or the shortcut to it, you can select Properties, and set the compatibility to XP, and also experiment with the 5 checkboxes in the middle of the dialog.
PLEASE NOTE You should first tick the checkbox down the bottom that says apply to all users, as that brings up another identical dialog that you should use instead.
Don't know what are you talking about.
With theme applied, The balloon tooltips re-positioned when mouse is moving in the button.
Re: jcButton Balloon tooltips flicker when themed (manifest) applied
Originally Posted by Bobbles
When you say "Don't know what are you talking about" what are you meaning ?
Are you saying that you do not know about using compatibility settings ?
Have you tested my attachment and duplicated the balloon tooltips flickering problem?
It's a hidden problem. Most of people didn't notice.
I have tested as you said.Seemed to be nothing about compatibility. Anyway, Thx sir.
Last edited by Jonney; Jan 18th, 2013 at 12:13 AM.
Reason: thanks given Bobbles
Re: jcButton Balloon tooltips flicker when themed (manifest) applied
Are you using Windows 7 ?
If so then no point in me testing in XP (which I love)
I do have Win 7 (which I hate) on one PC, but I tried cloning the drive from IDE to SATA and it ain't booting (did I mention that I hate Win 7). I have not gotten around to fixing it yet.
Which is why I ask, are you using Win7
Rob
PS Getting the correct combination of the 5 checkboxes is tricky. Try switching off all the win 7 aero crap, and get it back to Classic. Then see if your problem is gone. If it is gone, then switch all the crap back on, and experiment further with the checkboxes.
PPS I am popping out to the bank etc. So I am not being rude if I don't answer for a couple of hours.
Last edited by Bobbles; Jan 18th, 2013 at 12:32 AM.
Reason: Added another PPS
Re: [RESOLVED] jcButton Balloon tooltips flicker when themed (manifest) applied
I am getting annoyed.
I had to ask some questions many times, before getting answers.
You don't take time to fully read our questions/suggestions, and to action/answer them.
I am not telling you to get your users to turn of Aero etc. I am suggesting that you do it to help narrow down if Win7's aero etc is clashing with your user control.
And after you have done that, you turn it on again. Then you experiment further with the checkboxes etc in compatibility . (you gave no details as to how what you did when you tried compatibility )
Your short ill thought out responses are extremely annoying.
We are trying to help, and you are glossing over things.
Re: [RESOLVED] jcButton Balloon tooltips flicker when themed (manifest) applied
I have tested as you said.Seemed to be nothing about compatibility. Anyway, Thx sir.
I also disable on Aero on desktop and also check on "disable visual theme' for the exe file and blablah, The problem is the same. (Win7)
But on win8, balloon tooltips is OK.
You mentioned you got XP, please help to test.
I have tested other commercial ActiveX controls with tooltips, the balloon is also flickering on Win7.
The flickering has more chance if you fast move in a series controls (few controls lay vertically) as my above screenshot
Last edited by Jonney; Jan 18th, 2013 at 08:52 AM.
Reason: more content
Re: [RESOLVED] jcButton Balloon tooltips flicker when themed (manifest) applied
Hi folks,
I know that this thread is 7 years old, but I just wanted to tell you that I found a solution: in the WndProc of the subclassed control, return -1 to the WM_ERASEBKGND message. That works fine for me.
(needless to say that I found this thread looking for a solution to my flickering tooltips...)