Hi Guys,
Need help in the current task..
I was trying to put a CMFCToolBar inside the CFormView and i thought will have no problems and used the code bellow. Now this form view is to be kept a Dockable pane. But while doing this i got few problems. To put the toolbar in the FormView, i did this..
The TOOLBAR in the RC File is like this..
IDR_TOOLBAR1 TOOLBAR 16, 16
BEGIN
BUTTON IDC_BTN_1
BUTTON IDC_BTN_2
BUTTON IDC_BTN_3
END
The InitialUpdate of the FormView Derived class is like this: -
void CMyFormView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
CWnd *pWnd = NULL;
CRect rcPos;
if(!m_wndToolView.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_TOOLBAR1))
{
TRACE0("Failed to Create Dialog Toolbar\n");
}
m_wndToolView.LoadToolBar(IDR_TOOLBAR1, 0, 0, TRUE /* Is locked */);
m_wndToolView.CleanUpLockedImages();
m_wndToolView.LoadBitmap(IDR_TOOLBAR1, 0, 0, TRUE /* Locked */);
m_wndToolView.SetPaneStyle(m_wndToolView.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | WS_CHILD | WS_TABSTOP);
m_wndToolView.SetPaneStyle(m_wndToolView.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT));
m_wndToolView.SetOwner(this);
CSize szToolBar = m_wndToolView.CalcFixedLayout( FALSE, TRUE ); // returning CSize(69,24).. which should have been CSize(48, 16)
}
Now a few problems i am getting are: -
1. The Toolbar images are not coming proper
2. The Update of the Toolbar items is not coming.
HARSH Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning.