May 24th, 2002 05:12 AM
#1
Toolbar In CView
I have a CToolBar inside a CView dirived class. It works pretty well, you can click on the buttons and all and the corrent messages are sent. But there is a problem. If the view that the ToolBar is in is not in focus, the ToolBar is disabled. You have to click on the view that the ToolBar is in to make it re-enable itself.
Please help me on this, Thanks.
May 24th, 2002 05:16 AM
#2
Update commands are by default sent to the active view only. Try adding the following to CMainFrame to change this routing:
Code:
BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
CDocument *pDoc = GetActiveDocument();
if(pDoc)
{
POSITION pos = pDoc->GetFirstViewPosition();
CView *pView = NULL;
while(pView = pDoc->GetNextView(pos))
{
if(pView != GetActiveView()
&& pView->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
}
}
return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
regards,
MiMec
May 24th, 2002 05:19 AM
#3
Thanks man, that worked great. Man, you guys here at CC rock.
September 11th, 2012 04:40 AM
#4
Re: Toolbar In CView
Dear Yonax,
how u managed to get CToolBar inside a CView dirived class.I m also trying to do ir, can you please share the code to achieve it.
Thanx in advance.
September 11th, 2012 07:17 AM
#5
Re: Toolbar In CView
Originally Posted by
vinay kaul
Dear Yonax,
how u managed to get CToolBar inside a CView dirived class.I m also trying to do ir, can you please share the code to achieve it.
Thanx in advance.
Yonax hasn't posted here in over 10 years.
September 11th, 2012 05:32 AM
#6
Re: Toolbar In CView
Why do you need to have a toolbar in the View? Toolbars are designed to be inside the Frame windows!
Victor Nijegorodov
September 11th, 2012 05:39 AM
#7
Re: Toolbar In CView
I am using splitted views and I want to keep options specific to a view in a toolbar assigned to it.
September 11th, 2012 06:06 AM
#8
Re: Toolbar In CView
But you could just update an already used toolbar or replace toolbars while toggling between the splitter panes!
Victor Nijegorodov
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks