Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets
You still haven't answer my questions:
Quote:
Originally Posted by
VictorN
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
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? :confused:
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. :cool:
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...
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? :confused:
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! :thumbd:
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?...
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.
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?....
Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets
Quote:
Originally Posted by
npuleio
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.
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
Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets
Quote:
Originally Posted by
npuleio
Please, attach the screenshot rather than this link to your post (there is a button "Manage Attachments" to do it)
1 Attachment(s)
Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets
Quote:
Originally Posted by
VictorN
Please, attach the screenshot rather than this link to your post (there is a button "Manage Attachments" to do it)
OK here the screenshot:
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,...)? :confused:
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
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.
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
Re: [MFC] DDX/DDV and DoDataExchange between nested PropertySheets
Quote:
Originally Posted by
npuleio
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.