ToolTips in CXTPToolBar |
Post Reply |
Author | |
fredwobus
Newbie Joined: 02 September 2004 Location: Austria Status: Offline Points: 22 |
Post Options
Thanks(0)
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 "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 Edited by fredwobus |
|
krulle
Newbie Joined: 05 October 2004 Status: Offline Points: 6 |
Post Options
Thanks(0)
|
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); |
|
fredwobus
Newbie Joined: 02 September 2004 Location: Austria Status: Offline Points: 22 |
Post Options
Thanks(0)
|
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 |
|
fredwobus
Newbie Joined: 02 September 2004 Location: Austria Status: Offline Points: 22 |
Post Options
Thanks(0)
|
Brilliant! I found the solution in another post on CodeJock https://forum.codejock.com/forum_posts.asp?TID=1361& PN=1 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 |
|
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 |