CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23
  1. #16
    Join Date
    Sep 2010
    Posts
    11

    Re: MFC Feature Pack - How to create CMFCPropertySheet control?

    Okay, I tried with the following code:

    Code:
    void CMFCTest4View::OnInitialUpdate()
    {
        CFormView::OnInitialUpdate();
        
        //Create the Properties Sheet
        if(!m_wndPropSheet.Create(this, WS_CHILD | WS_VISIBLE | CBRS_TOP))
        {
            TRACE0("Failed to create toolbar\n");
            //return -1;      // fail to create
        }
    
        GetParentFrame()->RecalcLayout();
        ResizeParentToFit();
    
        //Make Properties Sheet visible
        m_wndPropSheet.MoveWindow(128,128,300,300,true);
    }
    I also tried:

    Code:
        //Make Properties Sheet visible
        RECT rectParent;
        GetParentFrame()->GetWindowRect(&rectParent);
        m_wndPropSheet.MoveWindow(rectParent.left, rectParent.top, rectParent.right-rectParent.left, rectParent.top-rectParent.bottom, true);

    But now I get an "Assertion Failed" right at startup. It is triggered by CWnd::MoveWindow()

    More specifically the following Assertion fails:
    Code:
    void CWnd::MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint)
    {
        ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));
    
        [...]
    }
    Any hint on how to resolve this would be very much appreciated.

    Regards,
    Daniel.
    Last edited by dtrick; September 30th, 2010 at 07:47 AM.

  2. #17
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: MFC Feature Pack - How to create CMFCPropertySheet control?

    It is very strange...
    Either your
    Code:
    m_wndPropSheet.Create(this, WS_CHILD | WS_VISIBLE | CBRS_TOP)
    failed or this CWnd::MoveWindow where assertion failed has nothing to do with
    Code:
        m_wndPropSheet.MoveWindow(128,128,300,300,true);
    Victor Nijegorodov

  3. #18
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: MFC Feature Pack - How to create CMFCPropertySheet control?

    Quote Originally Posted by dtrick View Post
    I also tried:

    Code:
        //Make Properties Sheet visible
        RECT rectParent;
        GetParentFrame()->GetWindowRect(&rectParent);
        m_wndPropSheet.MoveWindow(rectParent.left, rectParent.top, rectParent.right-rectParent.left, rectParent.top-rectParent.bottom, true);
    Where is this code called from?
    Victor Nijegorodov

  4. #19
    Join Date
    Sep 2010
    Posts
    11

    Re: MFC Feature Pack - How to create CMFCPropertySheet control?

    Quote Originally Posted by VictorN View Post
    It is very strange...
    Either your
    Code:
    m_wndPropSheet.Create(this, WS_CHILD | WS_VISIBLE | CBRS_TOP)
    failed or this CWnd::MoveWindow where assertion failed has nothing to do with
    Code:
        m_wndPropSheet.MoveWindow(128,128,300,300,true);
    You are right, the Create() failed. I put a MessageBoxW() where I had commented out the "return -1" before and it was triggered.

    So, any hints on why it couldn't be created? Do I need to specify different flags? Or maybe CreateEx() must be used to create that control?

    I would be glad for any advice on how to create a control and add it to the main window in MFC. I can't be the first person who tries to accomplish that

    Thanks in advance...


    Quote Originally Posted by VictorN View Post
    Where is this code called from?
    From the same location where I called the MoveWindow() before, i.e. from void CMFCTest4View::OnInitialUpdate() method.

  5. #20
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: MFC Feature Pack - How to create CMFCPropertySheet control?

    Quote Originally Posted by dtrick View Post
    So, any hints on why it couldn't be created? Do I need to specify different flags? Or maybe CreateEx() must be used to create that control?
    You asked already a lot of times about CreateEx for propertysheet. Didn't you read my answer about it? If you don't believe me - search MSDN for how to create propertysheet with propertypages.

    To find out the reason why Create failed - debug your code, step in to the Create method and go step-by-step (F10) through the code until you meet the problem...

    BTW, this my code is about 10 years old and it works ...
    Code:
    // in header
    	CDisabPropSheet m_PropSheet;  // CDisabPropSheet is derived from CPropertySheet 
    
    // class CSpconfigView is derived from CFormView
    ...
    		m_PropSheet.Create(this,   WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS  );
    Victor Nijegorodov

  6. #21
    Join Date
    Sep 2010
    Posts
    11

    Re: MFC Feature Pack - How to create CMFCPropertySheet control?

    Quote Originally Posted by VictorN View Post
    You asked already a lot of times about CreateEx for propertysheet. Didn't you read my answer about it? If you don't believe me - search MSDN for how to create propertysheet with propertypages.
    I'm just wondering how the issue could be resolved. If you tell me you got it working with Create() instead of CreateEx(), I believe you

    However I still didn't find an enlightening answer on when MFC controls need to be created with Create() and when they need to be created with CreateEx().

    In my project I see a wild mixture of both of t hem...


    Quote Originally Posted by VictorN View Post
    To find out the reason why Create failed - debug your code, step in to the Create method and go step-by-step (F10) through the code until you meet the problem...

    BTW, this my code is about 10 years old and it works ...
    Code:
    // in header
    	CDisabPropSheet m_PropSheet;  // CDisabPropSheet is derived from CPropertySheet 
    
    // class CSpconfigView is derived from CFormView
    ...
    		m_PropSheet.Create(this,   WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS  );
    The problem is, that I wouldn't have to debug my code, but Microsoft's code. After stepping into the Create() I will end up somewhere in the MFC framework. I really don't think I am supposed to debug the framework code. It must be able to create a control in MFC without debugging the framework itself. Anyway, when I have more time I will give a try. Maybe I can find some hint on the problem at least, even though I doubt I will be able to fix it, if the problem lies inside the framework.

    About your code snippet: You don't have a piece of code that actually compiles through you could share?

    I'm off for this week, but the struggly continues on monday

    Best regards,
    Daniel.

  7. #22
    Join Date
    Nov 2011
    Posts
    4

    When CMFCPropertySheet::PropSheetLook_List option is used , scroll bars are not disp

    When CMFCPropertySheet::PropSheetLook_List option is used , scroll bars are not displayed



    When CMFCPropertySheet::PropSheetLook_List option is used , scroll bars are not displayed

    ----------------------------------------------------------------------------------------------------------------------

    According to MSDN :

    For PropSheetLook_List

    The framework displays scroll arrows if there are more list items than will fit in the visible area of the list.

    Unfortunately, scroll bars are not displayed when there are many items presents outside visible area.

  8. #23
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: MFC Feature Pack - How to create CMFCPropertySheet control?

    Dear amitgpatil,
    what does your post have to do with this thread where we discussed the problem "MFC Feature Pack - How to create CMFCPropertySheet control?"?

    Please, don't revive the old threads if they don't need it!
    PS: note that you may be banned for such type of posts!
    Victor Nijegorodov

Page 2 of 2 FirstFirst 12

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