CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2010
    Posts
    30

    menu item enabling

    MENU ITEM ID_VIEW_WINDOWS_MESH IS DISABLED WHEN PROGRAM STARTS, WHY NOT ENABLED?
    WHEN I PUT THE FUNCTION "SwitchToView(IDW_MESH_VIEW);" IN:
    Code:
    void CSwicthViewFrame::OnShowWindow(BOOL bShow, UINT nStatus) 
    {
    	CFrameWnd::OnShowWindow(bShow, nStatus);
    	SwitchToView(IDW_MESH_VIEW);
    }
    THE FUNCTION GETS CALLED, BUT WHEN I DEBUG AND SET A BREAK POINT IN OnUpdateViewWindowsMesh() ISN'T GETTING CALLED AND MENU ITEM NOT ENABLING?

    PLEASE HELP, THANKS!
    Code:
    //////////////resource.h
    #define ID_VIEW_WINDOWS_MESH            32777
    
    ///////////////////TFR360Frame
    BOOL TFR360Frame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
    {
    	if (!m_wndSplitter.CreateStatic(this, 1, 2))
    	{}
    	if (!m_wndSplitter.CreateView(0, 0,RUNTIME_CLASS(CToolBox),CSize(xx, yy), pContext))
    	{}
    	if (!m_wndSplitter2.CreateStatic(&m_wndSplitter,2, 2,WS_CHILD|WS_VISIBLE|WS_BORDER,
    										m_wndSplitter.IdFromRowCol(0, 1)))
    	{}
    	if (!m_wndSplitter2.CreateView(0, 0,RUNTIME_CLASS(TopView), CSize((xx,yy), pContext))
    	{}
    	if (!m_wndSplitter2.CreateView(1, 0,RUNTIME_CLASS(FrontView), CSize((xx,yy)), pContext))
    	{}
    	if (!m_wndSplitter2.CreateView(0, 1,RUNTIME_CLASS(----->CSwicthViewFrame<------), CSize(xx, yy), pContext))
    	{}
    	if (!m_wndSplitter2.CreateView(1, 1,RUNTIME_CLASS(RightView), CSize(xx, yy), pContext))
    	{}
    	return TRUE;
    }
    
    /////////////////////IMPLEMENT_DYNCREATE(CSwicthViewFrame, CFrameWnd)
    
    BEGIN_MESSAGE_MAP(CSwicthViewFrame, CFrameWnd)
    	//{{AFX_MSG_MAP(CSwicthViewFrame)
    	ON_WM_SHOWWINDOW()
    	ON_COMMAND(ID_VIEW_WINDOWS_MESH, OnViewWindowsMesh)
    	ON_UPDATE_COMMAND_UI(ID_VIEW_WINDOWS_MESH, OnUpdateViewWindowsMesh)
    	//}}AFX_MSG_MAP
    END_MESSAGE_MAP()
    
    void CSwicthViewFrame::OnViewWindowsMesh() 
    {
    	SwitchToView(IDW_MESH_VIEW);	
    }
    
    void CSwicthViewFrame::OnUpdateViewWindowsMesh(CCmdUI* pCmdUI) 
    {pCmdUI->Enable(TRUE);
    	// TODO: Add your command update UI handler code here
    	
    }

  2. #2
    Join Date
    Feb 2010
    Posts
    30

    Re: menu item enabling

    the frame that I attatched the menu item to thru a splitter window has no view attatched (is that the reason why the menu item is not enabling?) that is the purpose for the menu item is connecting a view and switching between different views, i figured that if the frame is attatched the menu item would work

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured