CPropertySheet Default Button
-
Hello, I have a dialog window based on CPropertySheet and I've added 2 CPropertyPages. I have 2 questions: 1) The constructor gives me also an apply button, but I can't find a way to get rid of it. I don't need it. 2) On my CPropertyPages I also have a default button. If I press the dialog closes instead of doing the functionality behind my page default button. I tried to override the OnOk on my Page, this shows my test message, so it is executed, but still the dialog closes. Any ideas how to override the CPropertySheet dialog default button so my CPropertyPage default button is executed, and nothing else? Thanks Wim
-
Hello, I have a dialog window based on CPropertySheet and I've added 2 CPropertyPages. I have 2 questions: 1) The constructor gives me also an apply button, but I can't find a way to get rid of it. I don't need it. 2) On my CPropertyPages I also have a default button. If I press the dialog closes instead of doing the functionality behind my page default button. I tried to override the OnOk on my Page, this shows my test message, so it is executed, but still the dialog closes. Any ideas how to override the CPropertySheet dialog default button so my CPropertyPage default button is executed, and nothing else? Thanks Wim
- here is some code that builds a property sheet and gets rid of apply
// build the property sheet
CPropertySheet CompSheet("Company Information"); // make new CPropertySheet
CCompBasic page1(pComp, TRUE); // classes derived from CPropertyPage
CCompAddr page2(pComp);
CCompBank page3(pComp);
CCompDiscountMaint page4(pComp);
CompSheet.AddPage(&page1); // add the pages to the sheet
CompSheet.AddPage(&page2);
CompSheet.AddPage(&page3);
CompSheet.AddPage(&page4);
CompSheet.m_psh.dwFlags |= PSH_NOAPPLYNOW; // hide the apply button2)in your dialog's onok you are probably still calling onok which is passed to the sheet.. at least thats my initial guess..
CMyDialog::OnOK()
{
AfxMessageBox("woop!");
// CDialog::OnOK(); <- make sure you arent still calling this
}i may be way off on the 2nd one.. but the 1st will work.. still a newb.. cut me some slack :P -dz
-
- here is some code that builds a property sheet and gets rid of apply
// build the property sheet
CPropertySheet CompSheet("Company Information"); // make new CPropertySheet
CCompBasic page1(pComp, TRUE); // classes derived from CPropertyPage
CCompAddr page2(pComp);
CCompBank page3(pComp);
CCompDiscountMaint page4(pComp);
CompSheet.AddPage(&page1); // add the pages to the sheet
CompSheet.AddPage(&page2);
CompSheet.AddPage(&page3);
CompSheet.AddPage(&page4);
CompSheet.m_psh.dwFlags |= PSH_NOAPPLYNOW; // hide the apply button2)in your dialog's onok you are probably still calling onok which is passed to the sheet.. at least thats my initial guess..
CMyDialog::OnOK()
{
AfxMessageBox("woop!");
// CDialog::OnOK(); <- make sure you arent still calling this
}i may be way off on the 2nd one.. but the 1st will work.. still a newb.. cut me some slack :P -dz
Hello, Thanks. The first part removed the apply button. The default button behaviour is still there am afraid. I dont't have any default calls in my overrided functions, stil he just act like if the OK button was pressed. I will have to explore the caves of CPropertySheet I suppose.
-
Hello, Thanks. The first part removed the apply button. The default button behaviour is still there am afraid. I dont't have any default calls in my overrided functions, stil he just act like if the OK button was pressed. I will have to explore the caves of CPropertySheet I suppose.