Toolbar handler not invoked
-
I have addded a toolbar in the OnCreate method of CMainFrame as below if (!m_UICtrlsBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_RIGHT | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_UICtrlsBar.LoadToolBar(IDR_TOOLBAR_DRAW)) { TRACE0("Failed to OSD Controls ToolBar\n"); return -1; } But the handlers for this toolbar wont work when child windows are restored or maximized. In other words - in the presence of child view windows the message handler for the toolbar is not invoked. IF I minimize/close the child windows the handler works.I have posted this several times.I am still unable to figure out the actual problem. Please let me know if my problem is not clear. laiju
-
I have addded a toolbar in the OnCreate method of CMainFrame as below if (!m_UICtrlsBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_RIGHT | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_UICtrlsBar.LoadToolBar(IDR_TOOLBAR_DRAW)) { TRACE0("Failed to OSD Controls ToolBar\n"); return -1; } But the handlers for this toolbar wont work when child windows are restored or maximized. In other words - in the presence of child view windows the message handler for the toolbar is not invoked. IF I minimize/close the child windows the handler works.I have posted this several times.I am still unable to figure out the actual problem. Please let me know if my problem is not clear. laiju
have addded a toolbar in the OnCreate method of CMainFrame as below if (!m_UICtrlsBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_RIGHT | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_UICtrlsBar.LoadToolBar(IDR_TOOLBAR_DRAW)) { TRACE0("Failed to OSD Controls ToolBar\n"); return -1; } IF I close the child windows the handler works.The handler wont work if the child window is minimized or restored either. laiju
-
have addded a toolbar in the OnCreate method of CMainFrame as below if (!m_UICtrlsBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_RIGHT | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_UICtrlsBar.LoadToolBar(IDR_TOOLBAR_DRAW)) { TRACE0("Failed to OSD Controls ToolBar\n"); return -1; } IF I close the child windows the handler works.The handler wont work if the child window is minimized or restored either. laiju
Any chance you have handlers for the same commands in either the view, frame or document of the child window? MFC's command routing give those a chance to handle commands before the main frame... -- jlr http://jlamas.blogspot.com/[^]
-
Any chance you have handlers for the same commands in either the view, frame or document of the child window? MFC's command routing give those a chance to handle commands before the main frame... -- jlr http://jlamas.blogspot.com/[^]
-
I have double checked this. The command ID_VIEW_DRAWTOOLBAR is not used anywhere in the project except for calling the handler OnDrawToolBar and update handler OnUpdateDrawToolBar in the mainframe laiju
Wild guess, but I'd check if ID_VIEW_DRAWTOOLBAR happens to be defined with the same number as some other command... Otherwise, I suggest setting a breakpoint in CMDIFrameWnd::OnCmdMsg() (it's in MFC's winmdi.cpp) with a condition (nID==ID_VIEW_DRAWTOOLBAR) and following the execution from there through the debugger to see how the message is routed and where it's being handled. -- jlr http://jlamas.blogspot.com/[^]