Changing CProperty pages at runtime. 
Author Message
 Changing CProperty pages at runtime.

hi,
   i was hoping to use the CProperySheet::SetActivePage() method to
programatically change between the property pages of my property sheet.
i have three CPropertyPage's in my property sheet. When the user push the OK
button i do a load of validation.
Now most of the things that need to be validated are on page one (0) but if
the user is on either of the next two pages then i want to return them to
the first page.
SetActivePage() seems to almost do this, However it does not cause that
particular page to appear as being active (as if the user had selected the
tab themselves).
The page i've set (page 0) is active but is buried undeneath the page that
was active when the user clicked OK. I tried calling Invalidate and
UpdateWindow immediatly after the call to SetActivePage(0) but is does not
appear to work. I also tried to set the focus to the page i wanted active
but no joy either.
The VC++  help does not say anything about updating the window after calling
SetActivePage(0).

Does anybody have any tips that they could share with me please?

Thanks in advance

martin



Sat, 08 Nov 2003 02:04:16 GMT  
 Changing CProperty pages at runtime.
Hi, Marty!

Here's the thing: SetActivePage is doing exactly what you want it to do for me. So I think you'll
need to show a bit of your code (a stripped down version). Where, When & How are you handling the
IDOK button notification? Have you tried debugging into the SetActivePage code to see if it gets to
the SendMessage(PSM_SETCURSEL, ...) ? I'll post this just for grins -- maybe it'll do more good than
harm...

    BOOL CMyPropertySheet::OnCommand(WPARAM wParam, LPARAM lParam)
    {
        if (LOWORD(wParam) == IDOK)
        {
            if (CMyPageOne* pPage1 = DYNAMIC_DOWNCAST(
                CMyPageOne, GetPage(0)))
            {
                CComboBox& rCombo = pPage1->m_comboFruits;

                ASSERT(IsWindow(rCombo));

                if (rCombo.GetCurSel() == CB_ERR)
                {
                    VERIFY(SetActivePage(0));

                    pPage1->GotoDlgCtrl(&rCombo);

                    AfxMessageBox(
                        _T("Please select your favorite fruit"),
                        MB_ICONEXCLAMATION|MB_OK);

                    rCombo.ShowDropDown();
                    return TRUE;
                }
            }
        }
        return CPropertySheet::OnCommand(wParam, lParam);
    }

HTH,

Jeff...
--
Please post all follow-ups to the newsgroup only.


Quote:
> hi,
>    i was hoping to use the CProperySheet::SetActivePage() method to
> programatically change between the property pages of my property sheet.
> i have three CPropertyPage's in my property sheet. When the user push the OK
> button i do a load of validation.
> Now most of the things that need to be validated are on page one (0) but if
> the user is on either of the next two pages then i want to return them to
> the first page.
> SetActivePage() seems to almost do this, However it does not cause that
> particular page to appear as being active (as if the user had selected the
> tab themselves).
> The page i've set (page 0) is active but is buried undeneath the page that
> was active when the user clicked OK. I tried calling Invalidate and
> UpdateWindow immediatly after the call to SetActivePage(0) but is does not
> appear to work. I also tried to set the focus to the page i wanted active
> but no joy either.
> The VC++  help does not say anything about updating the window after calling
> SetActivePage(0).

> Does anybody have any tips that they could share with me please?

> Thanks in advance

> martin



Sat, 08 Nov 2003 08:17:32 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Cproperty page how to question

2. Populating Combo Boxes on Separate CProperty Pages

3. Creating CProperty Page in a Static Lib

4. Placing a CSplitterWnd inside a CProperty Page

5. CProperty Page Fonts

6. CProperty Page - Edit Controls - highlighted text

7. How can I change pages in property page?

8. Why changing pages in COlePropertyPage always applies changes.

9. Display property page at runtime

10. Disable CPropertySheet Page at runtime

11. Displaying Activex property pages at runtime

12. Access the values on the Property-pages in runtime

 

 
Powered by phpBB® Forum Software