Displaying a tooltip for a ComboBox

Discussion in 'MFC' started by nlraley, Jul 20, 2010.

  1. nlraley

    nlraley New Member

    Joined:
    Jul 20, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    I'm displaying tooltips for controls in my dialog based application written with MFC like this:

    1. Using CToolTipCtrl ToolTips; class object

    2. Add tooltips to controls like this:
    Code:
    CWnd* pDialogCtrlWnd = GetDlgItem(ID_COMBOBOX1);
    ToolTips.AddTool(pDialogCtrlWnd, pTooltipText);
    3. And then process them:
    Code:
    BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
    {
    	// TODO: Add your specialized code here and/or call the base class
    
    	//Tooltip management
    	ToolTips.RelayEvent(pMsg);
    
    	return CDialog::PreTranslateMessage(pMsg);
    }
    
    This scheme seems to work fine, except when I try to add a tooltip to a dropdown ComboBox control. It gets displayed for the button part of the combo box only. I know that the combo box houses an edit control internally, so I tried to use that edit control's HWND handle for adding a tooltip but that didn't help either.

    How do I need to change this code to make it work for a combo box?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice