Link to home
Start Free TrialLog in
Avatar of khf
khf

asked on

adding buttons to the Propertysheet.

i have a class CMypropertysheet with 4 pages .
i can design the pages by changing their dialod boxes but i can´t change the design of the Propertysheet dialog ,that contain my 4 pages.
how can i add buttons to a dialog Mypropertysheet and how can i delete the buttons OK or CANCEL for example.
there is no Dilog for the propertysheet in the ressources  
Avatar of Shay050799
Shay050799

u are wasting your points
Adding buttons is not a simple process. But removing or hiding button will be simple trick. There is no resource associated with property sheet. But we can make use of virtual functions of dialog box. Make use of InInitdialog function.
the IDs of butons on the sheet are
IDOK, IDCANCEL, ID_APPLY_NOW

BOOL CMyPropSheet::OnInitDialog ()
{
BOOL bResult = CPropertySheet::OnInitDialog ();
CWnd *pWnd = GetDlgItem (IDOK);
ASSERT (NULL != pWnd);
pWnd->ShowWindow (SW_HIDE);

pWnd = GetDlgItem (IDCANCEL);
ASSERT (NULL != pWnd);
pWnd->ShowWindow (SW_HIDE);

// Lets chage the caption of apply button.

pWnd = GetDlgItem (ID_APPLY_NOW);
ASSERT (NULL != pWnd);
pWnd->SetWindowText (_T ("My apply"));

return bResult;
}

For adding more buttons, either you do the hard way of caluclating the layout of property sheet and adding the buttons at run time at required locations.
Or simple way is make use of mehtod of embedding property sheets on dialog boxes. For this you can have a look at the examples posted on codeguru.com site.

Cheers!
khf,
did it work for u?

and shay....
whats the meaning of ur answer. no point giving up on these minor MFC issues :)
ASKER CERTIFIED SOLUTION
Avatar of naveenkohli
naveenkohli

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
he never comment he rejected my answer elsewhere without say nothing, that why i answer nothing here...
shay..
i noticed that.. may  be he wants free answers :)
i m not going to help him, untill he changed his attitude, this web site is suppose to help us to improve ourself, by commenting u can understand if u wrong or right

and he just thinking about himself

sorry