Set tooltip text and description dynamically |
Post Reply |
Author | |
iftekhar
Groupie Joined: 25 June 2007 Location: United Kingdom Status: Offline Points: 10 |
Post Options
Thanks(0)
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
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
iftekhar
Groupie Joined: 25 June 2007 Location: United Kingdom Status: Offline Points: 10 |
Post Options
Thanks(0)
|
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
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |