Re: MDI document window and toolbar tooltips
Nothing jumps out in that code.
Although you would typically create your toolbars in the OnCreateClient
method.
Something like this:
BOOL CMdvMDIChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext*
pContext)
{
if (!m_wndToolBar.CreateEx(this,TBSTYLE_TOOLTIPS| TBSTYLE_FLAT, WS_CHILD
| WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(m_toolbarResId))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return CMDIChildWnd::OnCreateClient(lpcs, pContext);
}
Your call to EnableToolTips does not effect the toolbar in any shape or
form. That call turns on tooltips for the Frame window.
AliR.
"Peter" <Peter@discussions.microsoft.com> wrote in message
news:34E24AF0-33A5-4BBE-A7D0-071B58FF7D1D@microsoft.com...
Hi AliR,
the code which creates tooltips is here:
int CMdvMDIChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
return -1;
EnableToolTips();
BOOL result = FALSE;
CRect toolbarRect(0,0,100,20);
result = m_wndToolBar.Create(this);
ASSERT(m_toolbarResId);// set it explicitly to right resource before
constructing view
result = m_wndToolBar.LoadToolBar(m_toolbarResId);
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS |
CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
result = m_wndToolBar.ShowWindow(SW_SHOW);
return 0;
}
Do you think that something wrong is in it ?
Thx!
Peter
"AliR (VC++ MVP)" wrote:
You might want to post the code where you create your toolbar in your
child
frame.
AliR.
"Peter" <Peter@discussions.microsoft.com> wrote in message
news:F03C49FF-B467-42E8-90E8-EEF9895095A6@microsoft.com...
I have MDI application. There is class CMyMDIChildFrame derived from
CMDIChildWindow (used for creating document template) I have added
toolbar.
Toolbar is created with CBRS_TOOLTIPS style.
Problem is that when mouse on some button in toolbar, then it displays
tooltip only if window ownering toolbar is not active.
When I activate (by mouse click) child window with toolbar, it does not
display tooltips, when I activate other child window then tooltips for
my
child window is displayed.
I tried also to use way: EnableTooltips() and ON_NOTIFY_EX(
TTN_NEEDTEXT,
0, OnTTNNeedText ),
but result is the same and handler is called only when mouse is on
button
AND windows is not active.
Have you any tip to solve this problem ?
Thx!
Peter