Solved

Modifying tooltips

Posted on 2004-09-19
7
314 Views
Last Modified: 2013-11-20
How can I modify the tooltips the MFC displays in the SDI/MDI application? I want them to be dynamically-adjustable, for instance, for the tooltip which corresponds to Undo I want to show something like "Undo: 5 more available".
0
Comment
Question by:Lescha
  • 3
  • 3
7 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 80 total points
Comment Utility
0
 
LVL 2

Expert Comment

by:bcsonka
Comment Utility
Hi,

Try using the CToolTipCtrl::UpdateTipText method.  Here's an example:

================================================================================

CString tooltipMsg = "My updated tooltip text";
tooltip->UpdateTipText(tooltipMsg, cwndPtr);

================================================================================

tooltip ==> pointer to an instance of CToolTipCtrl
cwndPtr ==> pointer to the control to contain the updated tooltip text (CWnd*)

I hope that helps.
0
 
LVL 1

Author Comment

by:Lescha
Comment Utility
Alex, could you please explain to me why there are 4 possibilities in the code? I thought Unicode would work only with one of *A or *W functions/types (which one, by the way?), and non-unicode with the other.

bcsonka, would that things could be that simple. I don't think there is a way of actually obtaining those pointers. If you know one please tell.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 48

Expert Comment

by:AlexFM
Comment Utility
There are two messages: TTN_NEEDTEXTA and TTN_NEEDTEXTW. Program may be in two configurations: ANSI and Unicode. This code is written by safety way, so that it is ready to handle TTN_NEEDTEXTW in ANSI configuration. I am not sure that this can actually happen, but safety is always good.
0
 
LVL 1

Author Comment

by:Lescha
Comment Utility
Okay... but don't I actually control whether or not my program is Unicode? Why bother with this #ifndef stuff?
0
 
LVL 48

Expert Comment

by:AlexFM
Comment Utility
This means, you always work in ANSI configuration created by VC++ by default. But you can add UNICODE configuration to your project and work in it (this is a best choice for WinNT and later). The code from this sample is OK both for UNICODE and ANSI configurations. You can read more information here:
http://www.codeproject.com/cpp/unicode.asp
 
0
 
LVL 1

Author Comment

by:Lescha
Comment Utility
Okay, thanks.
The answer most probably will go to Alex, but I'll wait for bcsonka for a day or two.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

17 Experts available now in Live!

Get 1:1 Help Now