Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Set tooltip text and description dynamically
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Set tooltip text and description dynamically

 Post Reply Post Reply
Author
Message
iftekhar View Drop Down
Groupie
Groupie


Joined: 25 June 2007
Location: United Kingdom
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote iftekhar Quote  Post ReplyReply Direct Link To This Post Topic: Set tooltip text and description dynamically
    Posted: 15 December 2009 at 7:26am
Hi,
 
I am working with CXTPCommandBars, which I use to create menubar and toolbar from frame and dialog window. I would like to set tooltip text and description dynamically when the mouse hovers on the toolbar controls.
 
I am using xtpToolTipLuna stype for the tool tip. I did the following to change the style of the tooltip.
 
 
void CSwToolTipCtrl::UpdateToolTipStyle(CXTPCommandBars* pCommandBars)
{
    if (!pCommandBars)
       return;
    pCommandBars->GetCommandBarsOptions()->bShowPopupBarToolTips = TRUE;
    if (CSwToolTipCtrl::m_nToolTipMode == TOOLTIP_MODE_NOVICE)
       pCommandBars->GetCommandBarsOptions()->ShowKeyboardCues(xtpKeyboardCuesShowWindowsDefault);
    pCommandBars->GetToolTipContext()->SetStyle(xtpToolTipLuna);
    pCommandBars->GetToolTipContext()->ShowTitleAndDescription(CSwToolTipCtrl::m_nToolTipMode == TOOLTIP_MODE_NOVICE);
    pCommandBars->GetToolTipContext()->ShowImage(TRUE);
}
 
 
But the tooltip text is loaded from the resource which I don't want and provide my own text and description. The text and description is provided based on the id of the control. Therefore when the mouse hover on a control I have to call SetDescription("Text") for that CXTPControl. But I might need a callback function or message handler to where I can do this. I tried OnToolTipText which is not getting called for CXTPCommandBars unlike standard MFC and OnToolHitTest which I did not have much luck with.
 
Could anybody please shed some light on it and tell me how I can do this?
 
Thanks in advance
 
Iftekhar
IAT
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 16 December 2009 at 5:32am
Hi,
 
You can catch WM_XTP_CONTROLSELECTED message. if wParam is not NULL it will point to new selected control.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
iftekhar View Drop Down
Groupie
Groupie


Joined: 25 June 2007
Location: United Kingdom
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote iftekhar Quote  Post ReplyReply Direct Link To This Post Posted: 16 December 2009 at 7:00am

Thanks Oleg. I tried this and it works. But this message is send once the tooltip is displayed. Therefore the first time I select a control the old tool tip is displayed then the WM_XTP_CONTROLSELECTED is handled. Then when I select the control second time the tooltip set for the control in WM_XTP_CONTROLSELECTED handler function is displayed. I tried setting an initial tool tip ON_XTP_AFTERCREATECONTROL() but that is no help to me because the user can change the tool tip mode after the controls are created at runtime which brings me to square one again. So is there any other message like WM_XTP_CONTROLSELECTED which is handled before tool tip is displayed.

 

Regards

 

Iftekhar

IAT
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.109 seconds.