Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

tool tip

Posted on 2000-02-24
3
Medium Priority
?
342 Views
Last Modified: 2013-11-20
I have created a tooltip in one of the propertypage. And I want to shwit up as the mouse moves over but it's not showing up. I handled it in Pretanslate message by using function realayevent()
. But the problem is this pretranslatemessage is not called up at all!!!!!!
Any ideas???
0
Comment
Question by:Bhaskar_Y
[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
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
RONSLOW earned 180 total points
ID: 2553774
Here is what I do...

In the message map...

ON_NOTIFY_EX_RANGE(TTN_NEEDTEXT,0,0xFFFF,OnToolTipNotify)

In OnInitDialog...

   EnableToolTips(true);

Add a handler to display the tooltip:

BOOL CMyPage::OnToolTipNotify( UINT /*id*/, NMHDR * pNMHDR, LRESULT * /*pResult*/ ) {
    static CString text;
    TOOLTIPTEXT *pTTT = reinterpret_cast<TOOLTIPTEXT*>(pNMHDR);
    UINT nID =pNMHDR->idFrom;
    if (pTTT->uFlags & TTF_IDISHWND) {
        // idFrom is actually the HWND of the tool
        nID = ::GetDlgCtrlID(reinterpret_cast<HWND>(nID));
        if(nID) {
            text = ToolTipString(nID);
            if (! text.IsEmpty()) {
                pTTT->lpszText = const_cast<LPTSTR>((LPCTSTR)text);
                pTTT->hinst = NULL;
                return true;
            }
        }
    }
    return false;
}

fix a 'bug' in CPropertyPage that stops the translation of the messages (this is probably what you are missing?):

BOOL CMyPage::PreTranslateMessage(MSG* pMsg) {
    return CWnd::PreTranslateMessage(pMsg);
}

And finally a function that returns the tooltip text for the control:

CString CMyPage::ToolTipString(UINT id) {
    return // whatever the string is
}

This works for me (I actually do this in a base class from which i derive all by property pages).

0
 

Author Comment

by:Bhaskar_Y
ID: 2553809
Hi thanks for that but What is TTN_NEEDTEXT?
and I am creating many cotrols on the property page at run time. It's not possible to have series of controlIDs.
So tell me why pretanslatemessage could not have been working?.
Tell me the easier thing to do

Thanks
Bhaskar
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2553926
TTN_NEEDTEXT is the message send what a tooltip control wants to know what text to display.

The example I gave is usually the simplest .. you find out the text to display based on the ID.

How do you intend to determine what text to display in the tooltip for each control?  One can probably easilty modify the code I gave for other methods.

PreTranslatemessage may not have been called if you did not get the declaration EXACTLY correct (correct return type, arg types etc).  That is one of the traps in C++ whne overriding virtual functions .. C++ won't tell you if you inadvertanly get the declaration wrong.. it just won't call your function.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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.
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

609 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