Print Page | Close Window

Adding Office 2007 tooltips to regular CButtons

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=9910
Printed Date: 14 November 2025 at 7:53pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Adding Office 2007 tooltips to regular CButtons
Posted By: gjasny
Subject: Adding Office 2007 tooltips to regular CButtons
Date Posted: 17 March 2008 at 11:06am
Hi,

I want to add Office 2007 style tooltips to regular CButtons inside a CDialog. Could anyone please outline the necessary steps? I.e. I don't know what to do with the CXTPToolTipContext.

Thanks!
Gregor



Replies:
Posted By: Oleg
Date Posted: 17 March 2008 at 1:25pm
Hi,
 
Check ToolTipContext sample. It shows how to use CXTPToolTipContext for Dialog.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: gjasny
Date Posted: 28 March 2008 at 1:14pm
Hi,

In OnInitDialog() I call now m_moduleContext.SetModuleToolTipContext();
This works as long as nobody else calls EnableTooltips() because the following lines in mfc/tooltips.cpp overwrites the m_pfnFilterToolTipMessage function pointer.

BOOL CWnd::_EnableToolTips(BOOL bEnable, UINT nFlag)
{
    [...]

    // if already enabled for tooltips, nothing to do
    if (!(m_nFlags & nFlag))
    {
        // success
        AFX_MODULE_STATE* pModuleState = _AFX_CMDTARGET_GETSTATE();
        pModuleState->m_pfnFilterToolTipMessage = &CWnd::_FilterToolTipMessage;
    }
    [...]
}


Another approach I tried, is to call m_moduleContext.FilterToolTipMessage(this, pMsg); in PreTranslateMessage(). But this has the downside that I need to change every window with tooltips.

Do you have any other hints for me?


Posted By: Oleg
Date Posted: 28 March 2008 at 3:45pm
Hi,
yeap SetModuleToolTipContext is designed method for global tooltip context.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: gjasny
Date Posted: 31 March 2008 at 5:20am
Originally posted by oleg oleg wrote:

yeap SetModuleToolTipContext is designed method for global tooltip context.


So if every call of EnableToolTips resets the desired effect, when and where should I call it?

Thanks,
Gregor


Posted By: Oleg
Date Posted: 01 April 2008 at 1:36am
Hi,
You can call SetModuleToolTipContext in constructor of your main form/dialog.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net