// /// Activates the specified page in the property sheet. Returns true if successful /// or false otherwise. /// \note The page that's losing activation receives a PSN_KILLACTIVE notification /// while the window that's gaining activation receives a PSN_SETACTIVE /// notification. // bool TPropertySheet::SelectPage(TPropertyPage& pg) { PRECONDITION(GetHandle()); PRECONDITION(HPROPSHEETPAGE(pg)); return SendMessage(PSM_SETCURSEL, 0, TParam2(HPROPSHEETPAGE(pg))) != 0; }
// /// Removes the specified page from the property sheet // void TPropertySheet::RemovePage(TPropertyPage& pg) { PRECONDITION(HPROPSHEETPAGE(pg)); CHECK(GetHandle()); SendMessage(PSM_REMOVEPAGE, 0, TParam2(HPROPSHEETPAGE(pg))); // // Should we actually invoke 'DestroyPropertySheetPage' for // Pages which are added then removed from the PropertySheet?? }
// /// Informs the sheet that the information in the specified page has reverted to the /// previously saved state. The sheet disables the 'Apply' button if no other pages /// have registered changes with the property sheet. // void TPropertySheet::PageUnchanged(TPropertyPage& pg) { PRECONDITION(HPROPSHEETPAGE(pg)); CHECK(GetHandle()); SendMessage(PSM_UNCHANGED, TParam1(pg.GetHandle())); }
BOOL CPropertyChoiceDlg::OnInitDialog() { CPropertyPage::OnInitDialog(); // nichtmodalen CPropertySheet erzeugen TRY { CRect rcClient; GetClientRect(&rcClient); m_pSheet = new CChoiceParent (rcClient, m_strDesc.c_str()); if (!m_pSheet -> Create(this, WS_VISIBLE|WS_CHILD|DS_CONTROL, 0)) AfxThrowMemoryException(); // geforderte Pages einhängen for (CPageList::iterator it = m_Pages.begin(); it != m_Pages.end(); it++) { m_pSheet -> SendMessage (PSM_ADDPAGE, 0, LPARAM(HPROPSHEETPAGE(*it))); } m_pSheet -> CleanUp(); // DummyPage wieder entfernen } CATCH(CMemoryException, e) { return E_OUTOFMEMORY; } END_CATCH; return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
// /// Adds a new page to the end of the PropertySheet. /// \note The 'pg' must have been created via a call to /// 'TPropertyPage::CreatePropertyPage' before invoking the 'AddPage' method. /// \note The property sheet is not resized to fit the new page. The new page should /// be no larger than the largest page already in the property sheet. // void TPropertySheet::AddPage(TPropertyPage& pg) { // Update pointer to parent object // if (pg.GetParentO() != this) pg.SetParent(this); // Have page create itself it necessary // pg.CreatePropertyPage(); CHECK(HPROPSHEETPAGE(pg)); // Inform sheet about new page // CHECK(HWND(*this)); SendMessage(PSM_ADDPAGE, 0, TParam2(HPROPSHEETPAGE(pg))); }
// /// Informs the sheet that information in a sheet has changed. The sheet enables the /// 'Apply' button. // void TPropertySheet::PageChanged(const TPropertyPage& pg) { PRECONDITION(HPROPSHEETPAGE(pg)); SendMessage(PSM_CHANGED, TParam1(pg.GetHandle())); }