Solved

Tooltips in CView disabled after showing dialog

Posted on 1998-06-07
12
508 Views
Last Modified: 2013-11-19
My tooltips in a CView window works fine if I don't invoke any (modal) dialog. If I display a dialog, then the tooltips don't show any more until another new CView is displayed. There was a similar known bug in MFC tooltip handling. How do I fix this problem? I tried EnableToolTips in CView again to no effect. [To emphasize: I am referring to the tooltips in the CView controls, not on the toolbar.]
0
Comment
Question by:stevejobs
  • 8
  • 4
12 Comments
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1316140
How do you do your tooltips in the view class?  Do you use EnableToolTips() ?

0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1316141
Do you mean that tooltips work.  The you display a (modal) dialog and CLOSE it, and the tooltips no longer work after that?

Or are you saying that they do not work WHILE the modal dialog is displayed?

What version of MC do you have?  Do you havethe latest service packs (SP3?)
0
 

Author Comment

by:stevejobs
ID: 1316142
Yes, I use EnableTooltips() when creating the CView window.
Yes, the tooltips work so long as I don't open any dialog. Once a dialog is opened (any dialog) and then closed and I go back to the CView window, tooltips don't appear again.
No, I am not saying they don't work while the dialog is displayed. I believe the dialog code somehow disable tooltips and I tried to reenable in CView but it didn't help.

I have Visual Studio C++ 5.0 and latest SP 3.
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 10

Expert Comment

by:RONSLOW
ID: 1316143
What happens if you click on the view (to ensure it is the active window)?

It could be that after your dialog closes, your view is not active (perhaps the frame is active instead).

0
 

Author Comment

by:stevejobs
ID: 1316144
I sure do click on the view. In fact, if I create a new view (this is an MDI app), the new view window will have tooltips active while the old one doesn't.
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1316145
hmmm .. let me dwell on that for a while.
0
 

Author Comment

by:stevejobs
ID: 1316146
I've just rechecked and can confirm that the 'activeness' of a view window doesn't affect the tooltips display. A view window can be inactive and still have tooltips. It seems the dialog (in my case) disables the tooltips of its parent and I just want to be able to reactivate the tooltip function in the view parent!!!
I know it's just one line of code, but where?
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1316147
Actually, I remember reading something about a similar problem (of tooltips not being reactiveated).  It is a bug in the code .. I'll try to track it down for you.

0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 220 total points
ID: 1316148
Here is the article (I think) .. but note that it says it does not apply when using EnableToolTips

Microsoft Knowledge Base
BUG: CToolTipCtrl Stops Working After Dialog Is Displayed
Last reviewed: June 26, 1997
Article ID: Q143313  
The information in this article applies to:
The Microsoft Foundation Classes (MFC) included with: Microsoft Visual C++, 32-bit Edition, versions 4.0, 4.1, 4.2, 5.0

SYMPTOMS

If you create a CToolTipCtrl and call AddTool() to activate it, it will work until you display a modal dialog box. For example, if on the Help menu, you click About to display the About box, and you then click OK to dismiss it, the CToolTipCtrl will not pop up anymore.

CAUSE

MFC is sending a WM_DISABLEMODAL to all of the frame's descendant windows when a modal dialog box pops up. The CToolTipCtrl responds to the WM_DISABLEMODAL by sending itself a TTM_ACTIVATE with a FALSE. This disables it. However, the CToolTipCtrl doesn't reactivate itself once the frame calls EnableWindow() for its descendants.

RESOLUTION

You should have a PreTranslateMessage() function where you are calling RelayEvent(). The workaround for this problem is to call Activate(TRUE) before the call to RelayEvent().

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

This is only a problem if you create your own CToolTipCtrl. Using EnableToolTips() does not have this problem.

Sample Code to Demonstrate Problem

   // m_pToolTip is a CToolTipCtrl *
   BOOL CTestView::PreTranslateMessage(MSG* pMsg)
   {
       switch(pMsg->message)
       {
           case WM_MOUSEMOVE:
           case WM_LBUTTONDOWN:
           case WM_LBUTTONUP:
           case WM_MBUTTONDOWN:
           case WM_MBUTTONUP:
           case WM_RBUTTONDOWN:
           case WM_RBUTTONUP:
               // This will reactivate the tooltip
               m_ToolTip.Activate (TRUE);
               m_ToolTip.RelayEvent (pMsg);
       }
       return CFormView::PreTranslateMessage(pMsg);
   }

   /* Compile options needed: default
   */
-----------------------------------------------------------------
Additional query words: CToolTipCtrl DoModal
Keywords : kbprg MfcUI vcbuglist400 vcbuglist500 kbbuglist
Technology : kbMfc
Version : 4.0 4.1 4.2 5.0
Platform : NT WINDOWS
Issue type : kbbug

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 26, 1997
©1997 Microsoft Corporation. All rights reserved. Legal Notices.

0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1316149
Are you doing anything with tooltips in the modal dialog?  Maybe that is having a similar effect?
0
 

Author Comment

by:stevejobs
ID: 1316150
RONSLOW:
You are marvellous. I suspected it was only one line of code and I tried the EnableToolTips while I should use the Activate(TRUE) statement.
Thank you!!! Bug is fixed.
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1316151
>You are marvellous

Glad to have my opinion of myself backed up :-)

And glad to help you.

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
xyBalance chalenge 58 96
Creating Labels and Frequency list style reports in SAS code 9 105
Process filename extension 3 196
changeXy challenge 13 89
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question