Where is the problem ? please help...
-
I am building an application with embeded property pages in a dialog (CDialog) Here is how i have done it; Following code is in the OnInitDialog m_PSheet=new CPropertySheet("Hello"); // Hello appears no where // Adding two property pages CPropertyPage m_PSheet->AddPage(&m_p1); m_PSheet->AddPage(&m_p2); //Modeless m_PSheet->Create(this,WS_CHILD,NULL); m_PSheet->ShowWindow(TRUE); Each propertypage contains a button which simply displays Message from Page 1 or page2. Both pages work absolutely fine as long there is no control on main dialog but if i add a button on main dialog; then pressing button on property pages losts the program (Hangs); the button on main dialog works fine; I want all controls on property pages and as well as on main dialog working. Please help;
-
I am building an application with embeded property pages in a dialog (CDialog) Here is how i have done it; Following code is in the OnInitDialog m_PSheet=new CPropertySheet("Hello"); // Hello appears no where // Adding two property pages CPropertyPage m_PSheet->AddPage(&m_p1); m_PSheet->AddPage(&m_p2); //Modeless m_PSheet->Create(this,WS_CHILD,NULL); m_PSheet->ShowWindow(TRUE); Each propertypage contains a button which simply displays Message from Page 1 or page2. Both pages work absolutely fine as long there is no control on main dialog but if i add a button on main dialog; then pressing button on property pages losts the program (Hangs); the button on main dialog works fine; I want all controls on property pages and as well as on main dialog working. Please help;
What I did for adding a CPropertySheet on a dialog is that first of all I added a Picture control on the dialog which was of the same size as that of the property sheet. I named that picture control as IDC_PROPSHEET and then I added a member variable named m_dlgPropSheet of the type of CPropertySheet. Then in OnInitDialog i did the following steps, after adding pages in Sheet. m_dlgPropSheet.Create(this,WS_CHILD|WS_VISIBLE,0); m_dlgPropSheet.ModifyStyleEx(0,WS_EX_CONTROLPARENT); m_dlgPropSheet.ModifyStyle( 0, WS_TABSTOP ); CRect rcSheet; GetDlgItem(IDC_PROPSHEET)->GetWindowRect(&rcSheet); ScreenToClient( &rcSheet ); m_dlgPropSheet.SetWindowPos(NULL,rcSheet.left-7, rcSheet.top-7, 0, 0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE ); Try doing this, Hope it would help. Still Alone in this beautiful world :( My Articles
-
I am building an application with embeded property pages in a dialog (CDialog) Here is how i have done it; Following code is in the OnInitDialog m_PSheet=new CPropertySheet("Hello"); // Hello appears no where // Adding two property pages CPropertyPage m_PSheet->AddPage(&m_p1); m_PSheet->AddPage(&m_p2); //Modeless m_PSheet->Create(this,WS_CHILD,NULL); m_PSheet->ShowWindow(TRUE); Each propertypage contains a button which simply displays Message from Page 1 or page2. Both pages work absolutely fine as long there is no control on main dialog but if i add a button on main dialog; then pressing button on property pages losts the program (Hangs); the button on main dialog works fine; I want all controls on property pages and as well as on main dialog working. Please help;
Obviously you are missing the PSheet point - it is not to be used in Dialog (at least normally). PSheet was designed to be used on itself only, providing general dialog with pages - I guess this is the reason you have problems. If you want to have dialog with pages among other controls, you will have to add it manually by adding tab control and managing tab switches yourself. I do have a class for this, if someone would be interested I could try to make an article on CP on with it. Igor Green http://www.grigsoft.com Compare It! + Synchronize It! : Files and folders comparison never was easier!
-
What I did for adding a CPropertySheet on a dialog is that first of all I added a Picture control on the dialog which was of the same size as that of the property sheet. I named that picture control as IDC_PROPSHEET and then I added a member variable named m_dlgPropSheet of the type of CPropertySheet. Then in OnInitDialog i did the following steps, after adding pages in Sheet. m_dlgPropSheet.Create(this,WS_CHILD|WS_VISIBLE,0); m_dlgPropSheet.ModifyStyleEx(0,WS_EX_CONTROLPARENT); m_dlgPropSheet.ModifyStyle( 0, WS_TABSTOP ); CRect rcSheet; GetDlgItem(IDC_PROPSHEET)->GetWindowRect(&rcSheet); ScreenToClient( &rcSheet ); m_dlgPropSheet.SetWindowPos(NULL,rcSheet.left-7, rcSheet.top-7, 0, 0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE ); Try doing this, Hope it would help. Still Alone in this beautiful world :( My Articles
Thank u very much ur code has solved my problem,:rose::rose::rose: Infact the difference between ur and my code is of the following two lines, adding them in my code has solved my problem; I have not changed my remaining code. m_PSheet.ModifyStyleEx(0,WS_EX_CONTROLPARENT); m_PSheet.ModifyStyle( 0, WS_TABSTOP ); According to MSDN. WS_EX_CONTROLPARENT Allows the user to navigate among the child windows of the window by using the TAB key How simply changing style to WS_EX_CONTROLPARENT solved it ? please desribe.
-
Obviously you are missing the PSheet point - it is not to be used in Dialog (at least normally). PSheet was designed to be used on itself only, providing general dialog with pages - I guess this is the reason you have problems. If you want to have dialog with pages among other controls, you will have to add it manually by adding tab control and managing tab switches yourself. I do have a class for this, if someone would be interested I could try to make an article on CP on with it. Igor Green http://www.grigsoft.com Compare It! + Synchronize It! : Files and folders comparison never was easier!
Thanks for reply :rose: I was also thinking that property pages are not working because of CDialog; but surprisingly they have. If u have time then please look the above solution provided by "Amir Butt" simply by changing style to "WS_EX_CONTROLPARENT" solved the problem; i.e. embeded propertypages in a dialog where as controls on pages and dialog are working fine. If u know what magic WS_EX_CONTROLPARENT has done then please describe. I could try to make an article on CP on with it. That will be a great greatness.
-
What I did for adding a CPropertySheet on a dialog is that first of all I added a Picture control on the dialog which was of the same size as that of the property sheet. I named that picture control as IDC_PROPSHEET and then I added a member variable named m_dlgPropSheet of the type of CPropertySheet. Then in OnInitDialog i did the following steps, after adding pages in Sheet. m_dlgPropSheet.Create(this,WS_CHILD|WS_VISIBLE,0); m_dlgPropSheet.ModifyStyleEx(0,WS_EX_CONTROLPARENT); m_dlgPropSheet.ModifyStyle( 0, WS_TABSTOP ); CRect rcSheet; GetDlgItem(IDC_PROPSHEET)->GetWindowRect(&rcSheet); ScreenToClient( &rcSheet ); m_dlgPropSheet.SetWindowPos(NULL,rcSheet.left-7, rcSheet.top-7, 0, 0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE ); Try doing this, Hope it would help. Still Alone in this beautiful world :( My Articles
-
Thank u very much ur code has solved my problem,:rose::rose::rose: Infact the difference between ur and my code is of the following two lines, adding them in my code has solved my problem; I have not changed my remaining code. m_PSheet.ModifyStyleEx(0,WS_EX_CONTROLPARENT); m_PSheet.ModifyStyle( 0, WS_TABSTOP ); According to MSDN. WS_EX_CONTROLPARENT Allows the user to navigate among the child windows of the window by using the TAB key How simply changing style to WS_EX_CONTROLPARENT solved it ? please desribe.
You are right. I used Picture control just for sizing it properly at my required position. AFAIK, WS_EX_CONTROLPARENT enables a control to be controlled by the parent. Since there is not a direct method to add CPropertySheet directly over a CDialog, therefore, I guess, we need to do this through this approach. I am not sure about its exact reason myself. Still Alone in this beautiful world :( My Articles