Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Tooltips in CView disabled after showing dialog

Posted on 1998-06-07
12
Medium Priority
?
548 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
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 880 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

688 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