-
May 4th, 2000, 03:13 AM
#1
Default button && CPropertyPage
I have a propertysheet with several pages in the application I am working with. The problem is that I can not disable/remove the "default" property for the default button on some of the pages (I do not want any of the buttons on the property pages to be default buttons since the default button is defined in the properysheet for all pages). It seems that when there is only one button on the page, that buttons is made the default button automatically.
If I look in the resource editor, the "default" property is NOT checked for any of the buttons. I have even tried the code snippet below to remove the "default" property if it is set but nothing seems to work.
In CPropertyPage::OnSetActive()
pBtn = (CButton*) this->GetDlgItem(IDC_BTN);
if(pBtn)
{
ulStyle = pBtn->GetButtonStyle();
if(ulStyle & BS_DEFPUSHBUTTON)
ulStyle -= BS_DEFPUSHBUTTON;
pBtn->SetButtonStyle(ulStyle, TRUE);
}
dwID = this->GetDefID();
wDefID = LOWORD(dwID);
wHasDefID = HIWORD(dwID);
if(wHasDefID == DC_HASDEFID && wDefID != 0)
{
// Remove current default button
CWnd* pWnd = this->GetDlgItem(wDefID);
if(pWnd)
{
ulStyle = ((CButton*)pWnd)->GetButtonStyle();
ulStyle -= BS_DEFPUSHBUTTON;
((CButton*)pWnd)->SetButtonStyle(ulStyle, TRUE);
}
}
Any ideas anyone???
/Mike
-
April 15th, 2009, 04:58 PM
#2
Re: Default button && CPropertyPage
BOOL CMyPropertyPage::SetActive()
{
GetParent()->PostMessage(DM_SETDEFID, ID_OF_DESIRED_BUTTON);
return CPropertyPage::SetActive();
}
Using PostMessage is required in order to delay until after normal processing.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|