Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CToolTips object from CXTToolBar in SDI
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CToolTips object from CXTToolBar in SDI

 Post Reply Post Reply
Author
Message
JoeSchmoe View Drop Down
Newbie
Newbie


Joined: 17 June 2003
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote JoeSchmoe Quote  Post ReplyReply Direct Link To This Post Topic: CToolTips object from CXTToolBar in SDI
    Posted: 17 June 2003 at 4:57pm

Hi,

I cannot seem to get a CToolTips object from a CXTToolBar that has been created normally in a CFrameWnd derived object. The tooltips are working and are visible on the bar.

It's created with:

if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
 {
  TRACE0("Failed to create toolbar\n");
  return -1;      // fail to create
 }

However, later if I call:

CToolTipCtrl* tips = this->m_wndToolBar.GetToolTips();

from inside the CFrameWnd derived object, tips is returned as NULL.

What I need to do ultimately is change the tool tip text at will.

Any help is appreciated.

Joe

Back to Top
kstowell View Drop Down
Admin Group
Admin Group


Joined: 25 January 2003
Location: MIchigan, USA
Status: Offline
Points: 496
Post Options Post Options   Thanks (0) Thanks(0)   Quote kstowell Quote  Post ReplyReply Direct Link To This Post Posted: 02 November 2003 at 2:34pm

Hi Joe,

The GetToolTips method will only work if you specify a tooltip control for the toolbar.  If you do so, you don't want to use the CBRS_TOOLTIPS flag because the toolbar will display 2 tooltips, its default one and the one you specify.  Here is an example:

In your .h file:

CToolTipCtrl m_wndToolTip;

In your .cpp file:

if (!m_wndBuildBar.CreateEx(this, TBSTYLE_FLAT|TBSTYLE_LIST, WS_CHILD | WS_VISIBLE | CBRS_TOP
    | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0,0,0,0), 59500) ||
   
!m_wndBuildBar.LoadToolBar(IDR_BUILD))
{
   
TRACE0("Failed to create toolbar\n");
   
return -1; // fail to create
}

m_wndToolTip.Create(this);
m_wndBuildBar.SetToolTips(&m_wndToolTip);

Then later you can call GetToolTips() to return a pointer to the tooltip control, but you may not need to since you already have the m_wndToolTip member.

CToolTipCtrl* ptips = m_wndBuildBar.GetToolTips();

Cheers,
Codejock Support

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