I have simple dialog that contain 4 buttons. I want to change those 4 button and make ToolBar that contain 4 button and will act exactly like those buttons.
In the h file CMFCToolBar ;
In the OnInitDialog method i call this code:
if(m_ToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, 100 ) )
{
m_ToolBar.SetPaneStyle(m_ToolBar.GetPaneStyle() & ~( CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_ANY ) );
m_ToolBar.InsertButton( CMFCToolBarButton( IDC_BTN_1, -1 , _T("Txt_1") ) );
m_ToolBar.InsertButton( CMFCToolBarButton( IDC_BTN_2, -1 , _T("Txt_2") ) );
m_ToolBar.InsertButton( CMFCToolBarButton( IDC_BTN_3, -1 , _T("Txt_3") ) );
m_ToolBar.InsertButton( CMFCToolBarButton( IDC_BTN_4, -1 , _T("Txt_4") ) );
CSize size = m_ToolBar.CalcFixedLayout( FALSE, TRUE );
m_ToolBar.SetWindowPos( NULL, 0, 0, size.cx + 10, size.cy + 10 , SWP_NOACTIVATE | SWP_NOZORDER );
}
- The IDC_BTN_XX is same ID as the original button => so in the BEGIN_MESSAGE_MAP i did not change anything => so i want to get the same Click event as before
But what happand is that in the toolbar click nothing happand => and the toolbar button is gray out when click.
What to do ? What i did wrong ?