CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 1999
    Posts
    9

    Why my view doesn't work first?

    Hello All:
    I Use splitter window in SDI application. I wrote code in Mainframe::OnCreateClient like this:
    // m_hSplitter is a CSplitterWnd object
    if(!m_hSplitter.CreateStatic(this,1,2)) return false;
    if(!m_hSplitter.CreateView(0,1,pContext->m_pNewViewClass,CSize(0,0),pContext)) return false;
    // m_hMywnd is m_hSplitter's child windows
    m_hMywnd.Create(...);
    m_hSplitter.SetColumnInfo(0,100,0);
    m_hSplitter.SetColumnInfo(1,200,0);
    m_hSplitter.RecalcLayout();

    My Splitter Window can display successfully.But Menu's Items which I wrote code for View is disabled untill I click the View client area. Is it possible let the items enabled when application start? thanks for any advice.

    nvc

  2. #2
    Join Date
    May 1999
    Posts
    128

    Re: Why my view doesn't work first?

    The reason the menu items are only enabled when you click on the view is because the handler's for them are in the view class. To make them available no matter what view is active then move all the handlers into the mainframe class.


  3. #3
    Join Date
    May 1999
    Location
    Atlanta, GA, USA
    Posts
    443

    Re: Why my view doesn't work first?

    Hi.

    Accroding as Visual C++ developers jounal, www.vcdj.com,
    Davide Marcato answered this kind of questions, but MDI with splitter
    window.

    Even though menu command leaves at View class, he added OnCmdMsg fun
    to CChildFrame.

    I think that this will work on SDI Application.
    Try to check this.

    HTH.
    -Masaaki Onishi-



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