Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Toolbar in CView not getting messages? Collapse All
Subject Author Date
Brett Cook Feb 5, 2007 - 11:44 AM

Dear tech support,

I have created a CExtToolControlBar inside of my CView following the examples in ProfStudio. Everything works fine, except the toolbar does not seem to be receiving mouse over messages. Meaning tooltips do not work, and the highlight of which button the mouse is hovering over does not work.

Is there something I need to do to ensure the toolbar gets these messages so the tooltips work?

Thanks,
-Brett

Brett Cook Feb 8, 2007 - 12:05 PM

Here are the specifics of what I am doing:

I have a class CMyView which is a child of CBaseView which is a child of CView. In my mainframe, I am creating a CExtControlBar and creating CMyView inside of it using the following code:

	CRuntimeClass * pRTC = RUNTIME_CLASS(CMyView);
	CView * pView = STATIC_DOWNCAST( CView, pRTC->CreateObject() );

	if ( !pView->Create(::AfxRegisterWndClass(0), _T(""), WS_CHILD|WS_VISIBLE, CRect(0,0,0,0), &m_wndMyBar, m_wndMyBar.GetDlgCtrlID(), NULL) )
	{
		TRACE0("Failed to create My view\n");
		return -1;
	}
In the OnCreate() of CMyView, I am creating a CExtToolControlBar using the following code:
	if(   (! m_wndToolBar.Create(
		NULL,
		this,
		AFX_IDW_TOOLBAR,
		WS_CHILD|WS_VISIBLE
		|WS_CLIPCHILDREN|WS_CLIPSIBLINGS
		|CBRS_ALIGN_TOP|CBRS_GRIPPER|CBRS_TOOLTIPS
		|CBRS_FLYBY|CBRS_SIZE_DYNAMIC
		) )
		|| (! m_wndToolBar.LoadToolBar(
		IDR_MY_TOOLBAR ) )
		)
	{
		ASSERT( FALSE );
		return -1;
	}
It is this toolbar that does not behave properly when the m_wndMyBar is floating. I would like to send you a UI shell of my program, however it has proven very difficult to strip out the guts of it.

Thanks for your help,
-Brett

Technical Support Feb 11, 2007 - 12:13 PM

We cannot say what’s wrong based on the information you provided. So we do need some project so that we can help you. It can be a version of your program or a modified version of one of our samples...

Brett Cook Feb 7, 2007 - 12:58 PM

Actually, I am having an issue with this when the controlbar is floating. The toolbar does not seem to receive ON_UPDATE_COMMAND_UI messages when floating and tooltips do not work.

Is there some setting that needs to be set in order for the floating behavior to work like the docked behavior?

Thanks,
-Brett

Technical Support Feb 8, 2007 - 3:56 AM

The re-dockable toolbars which are enabled for switching into the floating state can be created inside a frame window only. If the toolbar is created inside any other kind of window, then it will have static behavior similar to the status bar’s behaviors. You told us you have created your toolbar inside view window. If this is true, then your toolbar will never become floating. We need to know more details about your project. We will clarify the source of any project much faster if you sent it to us.

Suhai Gyorgy Feb 8, 2007 - 1:54 AM

Just a guess: Maybe with floating controlbar the mainframe is the first to get the message, but there it is not handled. In some samples I saw this code:

BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) 
{
	if( m_wndMenuBar.TranslateMainFrameMessage(pMsg) )
		return TRUE;
	// first let the view handle the message
	if( m_wndView.PreTranslateMessage(pMsg) )
		return TRUE;
	return CFrameWnd::PreTranslateMessage( pMsg );
}
Of course this exact code is only good with SDI, but I’m guessing the same approach might solve your problem, too.

Brett Cook Feb 5, 2007 - 11:58 AM

Nevermind, the buttons in question were simply disabled. Doh! All works well now. Thanks =).