Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Where is the problem ? please help...

Where is the problem ? please help...

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pc_dev
    wrote on last edited by
    #1

    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;

    A U 2 Replies Last reply
    0
    • P pc_dev

      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;

      A Offline
      A Offline
      Aamir Butt
      wrote on last edited by
      #2

      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

      P 2 Replies Last reply
      0
      • P pc_dev

        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;

        U Offline
        U Offline
        User 307386
        wrote on last edited by
        #3

        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!

        P 1 Reply Last reply
        0
        • A Aamir Butt

          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

          P Offline
          P Offline
          pc_dev
          wrote on last edited by
          #4

          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.

          A 1 Reply Last reply
          0
          • U User 307386

            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!

            P Offline
            P Offline
            pc_dev
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • A Aamir Butt

              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

              P Offline
              P Offline
              pc_dev
              wrote on last edited by
              #6

              One thing more; I think u have used Picture control only for sizeing, and it has nothing to do with real problem.

              1 Reply Last reply
              0
              • P pc_dev

                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.

                A Offline
                A Offline
                Aamir Butt
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups