Hiding the Standard Buttons

WEBINAR: On-demand webcast

How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >

In the previous topic we discussed how to remove the Apply button. The technique covered here is applicable to any control as long as we know its control ID. When we hide a control using the ShowWindow() function all the other controls remain whereever they were. If the gap gives the property sheet an unappealing look, consider repositioning the other controls to fill up the gap.

The code below will hide the OK button. The IDs of the standard buttons are IDOK, IDCANCEL, IDHELP and ID_APPLY_NOW.


	CWnd *pWnd = GetDlgItem( IDOK );
	pWnd->ShowWindow( FALSE );



Comments

  • Destroying the HIDE Button

    Posted by SweetSarah on 04/13/2006 12:44am

    Hi all, rather than going through any long procedures just comment the following line in CPropertySheet derived class

    ON_COMMAND(ID_HELP, CWinApp::OnHelp)

    Regards,
    Sarah

    Reply
  • Easy way of hiding default buttons from PropertySheet with out error

    Posted by Legacy on 11/19/2003 12:00am

    Originally posted by: S. Soundar Rajan

    Easy way for removing default buttons from PropertySheet.
    
    


    HBRUSH CPropertySheetWnd::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
    {
    HBRUSH hbr = CPropertySheet::OnCtlColor(pDC, pWnd, nCtlColor);

    if(pWnd->GetDlgCtrlID() == IDOK) //Hide OK Button From Property Sheet
    pWnd->ShowWindow(FALSE);

    if(pWnd->GetDlgCtrlID() == IDCANCEL) //Hide CANCEL Button From Property Sheet
    pWnd->ShowWindow(FALSE);

    if(pWnd->GetDlgCtrlID() == ID_APPLY_NOW) //Hide APPLY Button From Property Sheet
    pWnd->ShowWindow(FALSE);

    return hbr;
    }


    Reply
  • Most Accurate DEFINITIVE & Easy way to Hide Help Button in VC6

    Posted by Legacy on 11/17/2003 12:00am

    Originally posted by: Yogesh Kshatriya

    The correct, defintive & easy way to hide the Help button is the one suggested by Stephane Pilote.

    Reply
  • Why doesn't the active page cahnge????????

    Posted by Legacy on 11/30/2002 12:00am

    Originally posted by: Catalin

    At CPropertySheet: i don't understand why after i receive the answer ok from the sheet, get active index only retreives the index of the first tab even if i changed it while running the application.
    it's like this

    if (dlgNew.DoModal() == IDOK)
    {
    int val = dlgNew.GetActiveIndex();
    ......
    }

    and i receive only 0;

    Reply
  • hiding default buttons of property sheet.

    Posted by Legacy on 10/17/2002 12:00am

    Originally posted by: nilesh

    u have given the code to hide the default buttons,but can u plz tell me where to write that code.

    Reply
  • How to i Handle the Help!!!!

    Posted by Legacy on 04/12/2002 12:00am

    Originally posted by: Rajesh

    Hi ,

    how do i handle the help in each page. for ex. i having each page in help button. If the user press the help button i want to show the message means. How i can do that?. How do i map the Help Button in the Class wizard. which message i have to handle?.

    any one give a idea pl.

    thanks,
    Rajesh. S
    (rajesh_s76@hotmail.com)

    Reply
  • how to remove the Cancel button....????

    Posted by Legacy on 11/19/2001 12:00am

    Originally posted by: Ganesh

    In my program I want to remove(not just hiding) the Cancel button from the Property sheet so that the OK button appears on the extreem right.. How to do it..??

    Any Idea..??

    Thanks,
    Ganesh

    Reply
  • How to stay on the same actived page after "OK" clicked (2)?

    Posted by Legacy on 11/16/2001 12:00am

    Originally posted by: Andreas Kops

    Hi,all Gurus:
    I have got the same problem.

    I want to verify something after "OK" button clicked in one PropertyPage, but if the condition is not valid, I need to stay in the same actived page. However, even I did not call CPropertyPage::OnOK(),the whole propertySheet are disapeared!! It is totally different than CDialog!
    Does anybody have good and simple idea to handle thai?
    Thanks in advance!

    Andreas

    Reply
  • DEFINITIVE way to hide the help button

    Posted by Legacy on 10/12/2001 12:00am

    Originally posted by: JT

    The method listed by Ed eichman does not work. It hides the "Help" button alright but if your mouse is active on the property sheet and you press the key F1, it launches the help. The only way it works is as stated by stephanie pilote..

    Reply
  • How to stay on the same actived page after "OK" clicked?

    Posted by Legacy on 10/03/2001 12:00am

    Originally posted by: James HU

    Hi,all Gurus:

    I want to verify something after "OK" button clicked in one PropertyPage, but if the condition is not valid, I need to stay in the same actived page. However, even I did not call CPropertyPage::OnOK(),the whole propertySheet are disapeared!! It is totally different than CDialog!
    Does anybody have good and simple idea to handle thai?
    Thanks in advance!

    James

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Microsoft Azure® is a leading choice for businesses looking to take advantage of the cloud. Azure is particularly appealing to businesses that have already invested in Microsoft on-premises and are now considering running these applications and other workloads in the cloud. To understand how to make this move to Azure, many businesses are turning to managed service providers (MSPs) with specific Azure expertise. Read this white paper to learn the eight key areas to focus on when considering an MSP for an …

  • The software-defined data center (SDDC) and new trends in cloud and virtualization bring increased agility, automation, and intelligent services and management to all areas of the data center. Businesses can now more easily manage the entire lifecycle of their applications and services via the SDDC. This Aberdeen analyst report examines how a strong foundation in both the cloud and internal data centers is empowering organizations to fully leverage their IT infrastructure and is also preparing them to be able …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date