Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Adding Office 2007  tooltips to regular CButtons
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Adding Office 2007 tooltips to regular CButtons

 Post Reply Post Reply
Author
Message
gjasny View Drop Down
Newbie
Newbie


Joined: 17 January 2008
Location: Germany
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote gjasny Quote  Post ReplyReply Direct Link To This Post Topic: Adding Office 2007 tooltips to regular CButtons
    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
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
gjasny View Drop Down
Newbie
Newbie


Joined: 17 January 2008
Location: Germany
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote gjasny Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 28 March 2008 at 3:45pm
Hi,
yeap SetModuleToolTipContext is designed method for global tooltip context.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
gjasny View Drop Down
Newbie
Newbie


Joined: 17 January 2008
Location: Germany
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote gjasny Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.