Solved

Tooltips in CView disabled after showing dialog

Posted on 1998-06-07
12
478 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Strange date stored 22 100
Replacement selected text 2 47
Change owner from userA to server Local Administrators 7 51
if loop in java 3 114
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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 …
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now