Print Page | Close Window

CToolTips object from CXTToolBar in SDI

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=71
Printed Date: 15 May 2024 at 11:20pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CToolTips object from CXTToolBar in SDI
Posted By: JoeSchmoe
Subject: CToolTips object from CXTToolBar in SDI
Date 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




Replies:
Posted By: kstowell
Date 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




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net