Print Page | Close Window

ToolTips in CXTPToolBar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=1398
Printed Date: 06 March 2025 at 4:22am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: ToolTips in CXTPToolBar
Posted By: fredwobus
Subject: ToolTips in CXTPToolBar
Date Posted: 11 November 2004 at 4:17am
Hi,

As you might remember from my post ( https://forum.codejock.com/forum_posts.asp?TID=1364&PN=1 - https://forum.codejock.com/forum_posts.asp?TID=1364& PN=1   "Attaching to a CWnd pSite does not work")  I am experimenting with a toolbar which sits inside a dialog window instead of a CFrameWnd.
I loose the ability to dock/float the toolbar, but that's not needed anyway.

I am trying to activate tooltips for this toolbar, but have failed so far.

The toolbar is created using
    CreateToolBar(WS_VISIBLE|WS_CHILD|CBRS_TOOLTIPS, pParentDlg);
i.e. the magic flag to activate the tooltips is switched on.

In the OnUpdateCmdUI method of the parent dialog I try the following to set the tooltip text:

   pCmdUI->Enable(TRUE);
   CXTPControl* pControl = CXTPControl::FromUI(pCmdUI);
   pControl->SetTooltip("Undo");

The enabling/disabling works perfectly, but I never see a tooltip.


How does the CommandBar handle tooltips?
Do I need to implement a TTN_NEEDTEXT message ?
Why does it work when the toolbar sits docked in a CFrameWnd ?


Cheers,
Fred



Replies:
Posted By: krulle
Date Posted: 11 November 2004 at 4:40am

I got tooltips working in my toolbar in a dialog based class. I construct the toolbar the same way as you. I have no update handlers and i don't use the SetTooltip method. I just add the controls in this way and give them a caption string. The string given to SetCaption() will be shown as tooltip.

CXTPControl* c = m_ToolBar.GetControls()->Add(xtpControlButton, cmdId);

c->SetFlags(xtpFlagManualUpdate);

c->SetCaption(caption);



Posted By: fredwobus
Date Posted: 11 November 2004 at 4:54am
Thanks for the hint.

My controls do not have the xtpFlagManualUpdate flag and are therefore controlled by the OnUpdateCmdUI method.

However, I tried setting the manual flag and the caption right after creating the toolbar. And i still don't see any tooltips.

I forgot to mention that my dialog and its toolbar are inside an ActiveX control.

In XTPCommandBar.cpp (version 9.51) in line 195 I found these lines
    #ifdef _XTP_ACTIVEX
        AFX_MODULE_STATE* pModuleState = _AFX_CMDTARGET_GETSTATE();
        pModuleState->m_pfnFilterToolTipMessage = &AxFilterToolTipMessage;
    #endif
Would that have something to do with it ?

Cheers,Fred



Posted By: fredwobus
Date Posted: 11 November 2004 at 6:43am

Brilliant! I found the solution in another post on CodeJock

https://forum.codejock.com/forum_posts.asp?TID=1361&PN=1 - https://forum.codejock.com/forum_posts.asp?TID=1361& PN=1  
"Task Panel Tooltips in ActiveX control "

All I need to do is to create a class based on CXTPToolBar, which overrides OnWndMsg, and in there I do the FilterToolTipMessage as described in the previous post.

I think this sort of thing could have been done in the toolkit. I hope future versions get tested inside ActiveX controls as well as in MFC monolithic apps.

Thanks for your help so far.

Cheers, Fred




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