Click to See Complete Forum and Search --> : PropertySheet: How to make the apply button work


Shahzad
March 28th, 1999, 11:16 AM
I have the followig code

CPropertySheet sheet;

CPage1 page1;

CPage2 page;

sheet.AddPage(&page1);

sheet.AddPage(&page2);

sheet.DoModal();

it displays a propertysheet with ok,cancel, and apply button but the last button is not enables. How will I use the

apply button?

Alvaro
March 28th, 1999, 12:50 PM
Take a look at the docs for CPropertyPage::SetModified().

Ramon Saenz-Badillos
March 28th, 1999, 06:16 PM
As Alvaro says you first have to enable the Apply button, to do this set

CPropertyPage::SetModifed(TRUE)whenever the user changes anything in each of

your property pages

CmyPropertyPage :public CPropertyPage {

// ...

protected:

afx_msg void OnChange();

//...}

BEGIN_MESSAGE_MAP(CmyPropertyPage,CPropertyPage)

ON_WHATEVER_CHANGES(/*what you change*/, OnChange)//call onchange when you

//handle whatever changes in the property sheet

END_MESSAGE_MAP

void CmyPropertyPage::OnChange()

{

SetModified(TRUE);

}

Once enabled you must handle it by writing in your property sheet a handler

for the BN_CLICKED message on the ID_APPLY_NOW, note that you only call

UpdateData() for the active property page, the others are already updated by

MFC. remember to update all views.

Hey if all else fails you can always add m_psh.dwFlags |=PSH_NOAPPLYNOW;

to your property sheet constructor. This hides the Apply button *grin*

Shahzad
March 28th, 1999, 06:51 PM
thankx for the help