Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to set a CXTPToolTipContext on a CXTPToolBar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to set a CXTPToolTipContext on a CXTPToolBar

 Post Reply Post Reply
Author
Message
scottp View Drop Down
Groupie
Groupie


Joined: 16 October 2006
Status: Offline
Points: 59
Post Options Post Options   Thanks (0) Thanks(0)   Quote scottp Quote  Post ReplyReply Direct Link To This Post Topic: How to set a CXTPToolTipContext on a CXTPToolBar
    Posted: 21 March 2007 at 11:02pm
I have a CXTPToolBar that is manually attached to a CWnd housed in a docking pane. I can find no way to set a CXTPToolTipContext on the toolbar as the m_pToolTipContext member of CXTPCommandBar is protected.
In this case the m_pToolTipContext member is NULL and I would like to set the style to match the rest of my standard commandbars.

Can some way pleased be added to allow the m_pToolTipContext member to be set (and get).


Back to Top
Oleg View Drop Down
Senior Member
Senior Member


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: 22 March 2007 at 2:03am
you can create some CXTPCommandBars object :
 
m_pCommandBars = CXTPCommandBars ::CreateObject()
 
...
 
m_pCommandBars->InternalrRelease();
 
 
 
and assign it to this toolbar.
 
pT->SetCommandBars(m_pC);
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
scottp View Drop Down
Groupie
Groupie


Joined: 16 October 2006
Status: Offline
Points: 59
Post Options Post Options   Thanks (0) Thanks(0)   Quote scottp Quote  Post ReplyReply Direct Link To This Post Posted: 22 March 2007 at 2:39am
Hi Oleg,

I tried your suggestion


int CDisplayPane::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
 VERIFY(m_wndToolBar.CreateToolBar(WS_TABSTOP|WS_VISIBLE|WS_CHILD|CBRS_TOOLTIPS, this));

  m_wndToolBar.SetButtons(Buttons,6);

CXTPCommandBars *pCommandBars = (CXTPCommandBars *)CXTPCommandBars::CreateObject();
  CXTPToolTipContext* pToolTipContext = pCommandBars->GetToolTipContext();
  pToolTipContext->SetStyle(xtpToolTipLuna);
  pToolTipContext->ShowTitleAndDescription();
 pToolTipContext->SetFont(m_pCommandBars->GetPaintManager()->GetIconFont());
  pToolTipContext->ShowImage(true);

m_wndToolBar.SetCommandBars(m_pCommandBars);
pCommandBars->InternalRelease();


But this crashes in CalcDockingLayout

void CDisplayPane::OnSize(UINT nType, int cx, int cy)
  {
  CWnd::OnSize(nType, cx, cy);

  int nTop = 0;

  if (m_wndToolBar.GetSafeHwnd())
    {
    CSize sz = m_wndToolBar.CalcDockingLayout(cx, /*LM_HIDEWRAP|*/ LM_HORZDOCK|LM_HORZ | LM_COMMIT);

    m_wndToolBar.MoveWindow(0, nTop, cx, sz.cy);
    m_wndToolBar.Invalidate(FALSE);
    nTop += sz.cy;
    }



Any suggestions?

Back to Top
scottp View Drop Down
Groupie
Groupie


Joined: 16 October 2006
Status: Offline
Points: 59
Post Options Post Options   Thanks (0) Thanks(0)   Quote scottp Quote  Post ReplyReply Direct Link To This Post Posted: 22 March 2007 at 2:53am
Hi Oleg,

I misunderstood part of your suggestion, I need to release the commandbar in the destructor.

This code works :)

  CXTPCommandBars *m_pCommandBars = (CXTPCommandBars *)CXTPCommandBars::CreateObject();
  CXTPToolTipContext* pToolTipContext = m_pCommandBars->GetToolTipContext();
  pToolTipContext->SetStyle(xtpToolTipLuna);
  pToolTipContext->ShowTitleAndDescription();
 
  m_pCommandBars->SetSite(this);

  m_wndToolBar.SetCommandBars(m_pCommandBars);
  VERIFY(m_wndToolBar.CreateToolBar(WS_TABSTOP|WS_VISIBLE|WS_CHILD|CBRS_TOOLTIPS, this));
 

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


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: 23 March 2007 at 2:48am
all right :)
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.063 seconds.