CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 2002
    Posts
    1,798

    Frozen grid in CView of SDI splitter

    I have been working with both Chris Mander's MFC grid and the Ultimate Grid.

    See for details:
    The Ultimate Grid Beginner's Guide By The Ultimate Toolbox, 25 Aug 2007
    http://www.codeproject.com/Articles/...rid_in_a_CView

    MFC Grid control 2.27 By Chris Maunder, 6 May 2010
    http://www.codeproject.com/Articles/...d-control-2-27

    Both of these grid controls work nicely in a SDI CView windows. But when I create a split window using CSplitterWnd and the following code in an attempt to create a split window with a CListView and and a CView using this code:

    Code:
    // in CMainFrame.h
    
    // Attributes
    public:
    	CSplitterWnd m_wndSplitter;
    
    //.. 
    // in CMainFrame.cpp
    //..
    
    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
    {
    	CSize size(0, 0);
    
    	// create a splitter with 2 columns
    	if (!m_wndSplitter.CreateStatic(this, 1, 2))
    	{
    		TRACE0("Failed to CreateStaticSplitter\n");
    		return FALSE;
    	}
    
    	// add the first splitter pane - the view in column 0 row 0
        if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CSelector), CSize(100, 100), pContext))
    	{
    		TRACE0("Failed to create CSelector pane\n");
    		return FALSE;
    	}
    
    	// add the second splitter pane - the view in column 1 row 0
        if (!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CUltSplitView), size, pContext))
    	{
    		TRACE0("Failed to create CUltSplitView pane\n");
    		return FALSE;
    	}
    
       	m_wndSplitter.SetActivePane(0, 0);
    	m_wndSplitter.EnableWindow(FALSE);
    
        return TRUE;
    
    }// OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
    the grid in the CView window appears but is frozen in both instances.

    I suspect there is some notification necessary to for the grid to send and receive messages from the split CView window, but I cannot figure out how to implement this notification.

    Unfortunately, even a demo application would be too large to append, but for anyone that is interested, the split method is encapsulated in the code I've presented here and the implementation of both grid controls is well explained in the links provided.

    Any help or suggestions would be greatly appreciated.
    mpliam

  2. #2
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Frozen grid in CView of SDI splitter

    Did you try to ask the authors of these class about the possible problems in MDI applications?
    Victor Nijegorodov

  3. #3
    Join Date
    May 2002
    Posts
    1,798

    Re: Frozen grid in CView of SDI splitter

    Yes, I have posted the problem on both sites - thanks for suggesting that. I believe this is something of a general question relating to CView s in CWndSplitter split windows. There must be some notification code that I'm missing since the problem occurs only in the split CView window and not in the SDI CView.
    mpliam

  4. #4
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Frozen grid in CView of SDI splitter

    Well, I never had any problems with CView derived classes in splitters. Neither in SDI nor in MDI. Althouh I never used any type of grid views.
    If you create a standard MDI of "Windows Explorer" type (splittered tree and list view) - will this problem with the freezing persist?
    Victor Nijegorodov

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Frozen grid in CView of SDI splitter

    Quote Originally Posted by Mike Pliam View Post
    Yes, I have posted the problem on both sites - thanks for suggesting that. I believe this is something of a general question relating to CView s in CWndSplitter split windows. There must be some notification code that I'm missing since the problem occurs only in the split CView window and not in the SDI CView.
    There's nothing about missing a notification code. This is the reason of your trouble:
    Code:
    	m_wndSplitter.EnableWindow(FALSE);
    I don't know what made you do that, but this is exactly where you're wrong.
    Best regards,
    Igor

  6. #6
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Frozen grid in CView of SDI splitter

    Quote Originally Posted by Igor Vartanov View Post
    There's nothing about missing a notification code. This is the reason of your trouble:
    Code:
    	m_wndSplitter.EnableWindow(FALSE);
    I don't know what made you do that, but this is exactly where you're wrong.
    Good catch, Igor!
    LOL! How could I misslook this line? Because of the presense of the vertical scrollbar?
    Victor Nijegorodov

  7. #7
    Join Date
    May 2002
    Posts
    1,798

    Re: Frozen grid in CView of SDI splitter

    Of course. How stupid of me. Thank you.
    mpliam

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