Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - ToolTips in CXTPToolBar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ToolTips in CXTPToolBar

 Post Reply Post Reply
Author
Message
fredwobus View Drop Down
Newbie
Newbie
Avatar

Joined: 02 September 2004
Location: Austria
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote fredwobus Quote  Post ReplyReply Direct Link To This Post Topic: ToolTips in CXTPToolBar
    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
Back to Top
krulle View Drop Down
Newbie
Newbie


Joined: 05 October 2004
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote krulle Quote  Post ReplyReply Direct Link To This Post 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);

Back to Top
fredwobus View Drop Down
Newbie
Newbie
Avatar

Joined: 02 September 2004
Location: Austria
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote fredwobus Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
fredwobus View Drop Down
Newbie
Newbie
Avatar

Joined: 02 September 2004
Location: Austria
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote fredwobus Quote  Post ReplyReply Direct Link To This Post 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 
"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

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.172 seconds.