CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 32
  1. #16
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets

    You still haven't answer my questions:
    Quote Originally Posted by VictorN View Post
    What exactly are you trying to achieve with the sheet resizing and what do all these magic numbers (10, 15) mean?
    Besides, your code has memory leaks (at least in the case of m_poPropSheet->Create(...) fails...
    Quote Originally Posted by npuleio View Post
    Code:
    BOOL CMyDialogDlg::OnInitDialog()
    {
    	CDialog::OnInitDialog();
    
    	...
    	// Extra initialization here
    	m_poPropSheet = new CPropertySheet();
    	pageConfig = new CPage_Config( m_poPropSheet );
    	m_poPropSheet->AddPage(pageConfig);
    
    	DWORD dwStyle = WS_VISIBLE | WS_CHILD;        
    	DWORD dwExStyle = WS_EX_LEFT|WS_EX_CONTROLPARENT;
    	if ( !m_poPropSheet->Create(this, dwStyle, dwExStyle) )
    	{
    		DestroyWindow();
    		return FALSE;
    	}
    
    	...
    	return TRUE;  // return TRUE  unless you set the focus to a control
    }
    Why do you create this property sheet in the heap?
    Just declare the CPropertySheet instance, NOT a pointer, then create it...
    Code:
    // in the header:
    protected:
    	HICON m_hIcon;
    	CPropertySheet m_PropSheet;
    
    // in the .cpp:
    	if ( !m_PropSheet.Create(this, dwStyle, dwExStyle) )
    	{
    		DestroyWindow();
    		return FALSE;
    	}
    The same - for the property pages.
    Victor Nijegorodov

  2. #17
    Join Date
    Aug 2009
    Posts
    84

    Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets

    Hello Victor,

    "What exactly are you trying to achieve with the sheet resizing and what do all these magic numbers (10, 15) mean?" <--- they are the space difference from the border of the CDialog where the width or the height has to be less than...

    About this:

    Code:
    m_poPropSheet = new CPropertySheet();
    I declared in .h the variable as you can see in the code pasted (there's a part which is the .h code), so it would be accessible in entire current document...

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

    Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets

    1. Why do you think that the "space difference from the border of the CDialog" will be exactly 10 and 15?
    No, they are not!

    2. And what prevents you to access propertysheet instance if you declare it as
    Code:
    	CPropertySheet m_PropSheet;
    Again: your code has memory leaks: you create objects with new but do not delete them!
    Victor Nijegorodov

  4. #19
    Join Date
    Aug 2009
    Posts
    84

    Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets

    In fact without using new and removing the *, it won't have a memory leak...tomorrow morning I'll fix it...

    About the sizing propertysheet and tabcontrol of propertysheet itself how I could set correctly this SetWindowPos to have correct full right and bottom size?...

  5. #20
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets

    I would try to remove the SWP_NOMOVE flag and use different cx and cy values.

  6. #21
    Join Date
    Aug 2009
    Posts
    84

    Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets

    HI Arjay....

    since I got difficulties applying document/view methodology on propertysheets and pages... so I would ask you if it's appliable also to modeless propertysheets that methodology for DDX/DDV DoDataExchange?....

  7. #22
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets

    Quote Originally Posted by npuleio View Post
    HI Arjay....

    since I got difficulties applying document/view methodology on propertysheets and pages... so I would ask you if it's appliable also to modeless propertysheets that methodology for DDX/DDV DoDataExchange?....
    Yes.

  8. #23
    Join Date
    Aug 2009
    Posts
    84

    Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets

    HI Arjay and Victor

    I removed the SWP_NOMOVE having this code:

    Code:
    void CMyDialogDlg::OnWindowPosChanged(WINDOWPOS* lpwndpos)
    {
    	CDialog::OnWindowPosChanged(lpwndpos);
    
    	if( m_bIsInitialized )	
    	{		
    		m_poPropSheet->SetWindowPos( NULL, 0, 0, 
    			lpwndpos->cx - 8, lpwndpos->cy - 80, SWP_NOZORDER ); 		
    
    		poControl->SetWindowPos( NULL, 0, 0, 
    		  	lpwndpos->cx - 8, lpwndpos->cy - 80, SWP_NOZORDER );
    	}
    }
    but I wonder what's this grey square that covers the bottom line of the tabcontrol as you can see here the screenshot:

    http://img407.imageshack.us/img407/9...reenshotok.jpg

    Maybe I have to add some resize code in the OnWindowPosChanged?...

    Thanks
    Luigi

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

    Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets

    Quote Originally Posted by npuleio View Post
    ...
    but I wonder what's this grey square that covers the bottom line of the tabcontrol as you can see here the screenshot:

    http://img407.imageshack.us/img407/9...reenshotok.jpg
    Please, attach the screenshot rather than this link to your post (there is a button "Manage Attachments" to do it)
    Victor Nijegorodov

  10. #25
    Join Date
    Aug 2009
    Posts
    84

    Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets

    Quote Originally Posted by VictorN View Post
    Please, attach the screenshot rather than this link to your post (there is a button "Manage Attachments" to do it)
    OK here the screenshot:
    Attached Images Attached Images  

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

    Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets

    Well, it looks like some child windows/controls are on the top...
    But what did you expected as a result of your trial and error method with those magic numbers (1, 5, 8, 10, 15, 80,...)?
    Victor Nijegorodov

  12. #27
    Join Date
    Aug 2009
    Posts
    84

    Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets

    Hello Victor and Arjay,

    I have to measure with those magic numbers (1, 5, 8, 10, 15, 80,...) because there's always a space to fit it...
    Anyway if you have a good suggest to fit sheets and pages in their client area without making them disappearing, I'd like a little help...

    Actually my code in OnWindowPosChanged is this:

    Code:
    m_poPropSheet->SetWindowPos( &CWnd::wndBottom, 0, 0,
                 lpwndpos->cx - 8, lpwndpos->cy - 65, SWP_NOZORDER );           
     
    poControl->SetWindowPos( &CWnd::wndBottom, 0, 0,
                 lpwndpos->cx - 8, lpwndpos->cy - 65, SWP_NOZORDER );
     
    //All another pages will be repositioned than user change tab
    //Get client area size         
    CRect oClientRect;             
    m_poPropSheet->GetClientRect( &oClientRect );
    CPropertyPage* poPage = m_poPropSheet->GetActivePage();
    if( poPage != NULL && poPage->m_hWnd != NULL )         
    {
              //poPage->ModifyStyleEx(WS_BORDER, 1, SWP_DRAWFRAME);
              poPage->SetWindowPos(&CWnd::wndBottom, oClientRect.left + 2, oClientRect.top + 25,                                      
                                      oClientRect.Width() - 5, oClientRect.Height() - 29, SWP_NOZORDER);
    }
    CWnd* pCtl = GetDlgItem(IDC_PROGRESSBAR);
    CRect WndRect;
    GetClientRect( &WndRect );
    pCtl->SetWindowPos(&CWnd::wndBottom, WndRect.left, WndRect.bottom - 15, 
                                      WndRect.Width(), 15, SWP_NOZORDER);
    and since I have nested pages and sheets for example the next level sheet disappear...wonder why... I tried also with NULL in the place of &CWnd::wndBotton... (the IDC_PROGRESSBAR is only at bottom in top level sheet, that causes that - 65 in the code otherwise it would be hided)

    Thanks
    Luigi

  13. #28
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets

    According to the sceenshot, it looks like another control is covering a portion of the sheet.

    If you need more help with this, zip up a small sample project and post it here. Be sure to remove the debug and release folders and delete the .ncb file before you zip it.

  14. #29
    Join Date
    Aug 2009
    Posts
    84

    Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets

    Hello Victor and Arjay,

    I have three nested levels of Propertysheets... I need to make active by code a page in another sheet which is in another page.... how I could do that?....

    Thanks in advance.
    Ciao
    Luigi

  15. #30
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets

    Quote Originally Posted by npuleio View Post
    Hello Victor and Arjay,

    I have three nested levels of Propertysheets... I need to make active by code a page in another sheet which is in another page.... how I could do that?....

    Thanks in advance.
    Ciao
    Luigi
    You probably want to rethink your design. Using nested property sheets is discouraged. 3 levels of nesting would really be a poor user experience.

Page 2 of 3 FirstFirst 123 LastLast

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