Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Toolbar tooltip for custom controls
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Toolbar tooltip for custom controls

 Post Reply Post Reply
Author
Message
akur View Drop Down
Senior Member
Senior Member


Joined: 16 May 2006
Status: Offline
Points: 139
Post Options Post Options   Thanks (0) Thanks(0)   Quote akur Quote  Post ReplyReply Direct Link To This Post Topic: Toolbar tooltip for custom controls
    Posted: 23 March 2007 at 5:00am
Hello,

I've added my own control into an XTP toolbar through CXTPControlCustom, but setting a tooltip text for this control just doesn't display any tooltip.

        CXTPControlCustom* pControlEmbedder = CXTPControlCustom::CreateControlCustom(&m_MyControl);
        pControlEmbedder->SetTooltip(_T("My Tooltip Text"));
        m_pMyToolbar->GetControls()->Add(pControlEmbedder);

Do you have any idea what's wrong with this? Do I have to handle tooltips of my control window on my own?

Thank you for any suggestions, in advance!

Back to Top
akur View Drop Down
Senior Member
Senior Member


Joined: 16 May 2006
Status: Offline
Points: 139
Post Options Post Options   Thanks (0) Thanks(0)   Quote akur Quote  Post ReplyReply Direct Link To This Post Posted: 26 March 2007 at 1:44am
One workaround would be to use a "normal" handling of tooltips for that single custom control of mine. Is there any commandbar-based solution for this?

Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post Posted: 06 September 2007 at 9:41am
Bump - I would like this please.
Simon HB9DRV
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: 07 September 2007 at 1:49am
Hi,
 
Here little workaround class:
 
template <class T>
class CToolTipRouter : public T
{
 BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
 {
  CXTPCommandBar* pCommandBar = DYNAMIC_DOWNCAST(CXTPCommandBar, GetParent());
  
  if (pCommandBar)
  {
   pCommandBar->FilterToolTipMessage(message, wParam, lParam);
  }
  if (message == XTP_TTM_WINDOWFROMPOINT)
  {
   *pResult = 1;
   return TRUE;
  }
  
  return CWnd::OnWndMsg(message, wParam, lParam, pResult);
 }
};
 
 
Now replace your m_MyControl declaration in mainfrm.h from
 
CMyClass m_MyControl;
 
to
 
CToolTipRouter<CMyClass> m_MyControl;
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post Posted: 07 September 2007 at 3:11am
Woo-Hoo, I'll try this today or tomorrow and see if I can get it working - many thanks.
Simon HB9DRV
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post Posted: 07 September 2007 at 10:32am
 Excellent - works just great :-)
 
Now for 11.2 - have a nice weekend.
 
 
Simon HB9DRV
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.203 seconds.