?
Solved

tool tip

Posted on 2000-02-24
3
Medium Priority
?
332 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

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