Hiding the Apply button

When the property sheet shows up, by default it has the Apply button visible and disabled. Often, we don't need the Apply button at all. Removing the button is a one liner and here's how. After you create the property sheet object just add the PSH_NOAPPLYNOW flag.

	propsheet.m_psh.dwFlags |= PSH_NOAPPLYNOW;



Comments

  • Works perfect

    Posted by nxn128 on 11/23/2005 03:16pm

    Just what I was looking for.

    Reply
  • How to add a property sheet to local area connection status page dialog?

    Posted by Legacy on 05/29/2003 12:00am

    Originally posted by: Slav

    I know that it is possible to extend standart property pages:
    In control panel - mouse settings, display settings etc.
    How to add a property sheet to local area connection status?

    Reply
  • How to hide the "help" button in the CPropertySheet dialog?

    Posted by Legacy on 01/02/2003 12:00am

    Originally posted by: hanhd

    Thank you for helping me!

    Reply
  • Right functionality of Apply Button

    Posted by Legacy on 03/28/2002 12:00am

    Originally posted by: luki

    hi, i'm making propertysheet dlg by using mfc. it means several PropertyPage dialogs in one PropertySheet dlg. My problem: if i delete or hide(ShowWindow(FALSE)) OK and Cancel buttons the Apply button will work not corectly. It means, to be enabled after change. It is enabled during all the existence of dlg. Can anybody help? I want to not to see Cancel,OK buttons in PropertyPage dlg and Apply button has right functionality at the same time. I handling Apply button by using OnCommand a OnApply methods thanks

    Reply
  • How to Set Tool Tip for the Buttons - OK, Cancel, Help in the Property sheet?

    Posted by Legacy on 03/14/2002 12:00am

    Originally posted by: Shankar.V.V.S.N

    Hi,
    
    I need to set tool tip for the OK, CANCEL, HELP buttons in a property sheet. I don't have the ids of them. I tried with the IDs :

    OK : IDOK
    CANCEL : IDCANCEL
    HELP : ID_HELP
    But i did not get the tool tip.

    [For getting tool tip, I used the following code:
    OnInitDialog()
    { .........
    .........
    ToolTipCtrl.Create(this,TTS_ALWAYSTIP);
    ToolTipCtrl.AddTool(GetDlgItem(IDOK),"OkTooltip);
    ToolTipCtrl.AddTool(GetDlgItem(IDCANCEL),"CancelTooltip");
    ToolTipCtrl.AddTool(GetDlgItem(ID_HELP),"HelpTooltip");
    .........
    .........
    }
    .........
    .........
    BOOL <<<Someclassname>>>::PreTranslateMessage(MSG* pMsg)
    {
    ToolTipCtrl.RelayEvent(pMsg);
    return CPropertyPage::PreTranslateMessage(pMsg);
    }
    ]

    I generally use the above procedure for setting the tooltips for a known ids.
    Thanks In advance..
    Shankar

    Reply
  • delete Apply button in a modal property sheet dialog

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

    Originally posted by: Fan Xia

    for a modal property sheet dialog, put line
    m_psh.dwFlags |= PSH_NOAPPLYNOW;

    in all constructor functions. then you can create a local property sheet object and call DoModal.

    Reply
  • Removing Apply and Moving Buttons so it looks better

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

    Originally posted by: Joe Sonderegger

    The following code not only removes the Apply button, 
    
    but also moves the buttons so that it looks normal again.

    CRect rect;
    CWnd* pButton = GetDlgItem(ID_APPLY_NOW);
    if(pButton->GetSafeHwnd())
    {
    pButton->GetWindowRect(&rect);
    ScreenToClient(&rect);
    pButton->DestroyWindow();
    pButton = GetDlgItem(IDCANCEL);

    if(pButton->GetSafeHwnd())
    {
    CRect CancelRect;
    pButton->GetWindowRect(&CancelRect);
    ScreenToClient(&CancelRect);
    pButton->SetWindowPos(NULL, rect.left, rect.top, 0,
    0, SWP_NOSIZE | SWP_NOZORDER);
    pButton = GetDlgItem(IDOK);
    if(pButton->GetSafeHwnd())
    pButton->SetWindowPos(NULL, CancelRect.left,
    CancelRect.top, 0, 0, SWP_NOSIZE |
    SWP_NOZORDER);

    }


    Reply
  • This how to remove some buttons easily...

    Posted by Legacy on 09/20/2001 12:00am

    Originally posted by: David A. Reyes

    This is the code showing how I did mine for a test app.
    
    

    BOOL CLearnerAppSheet::OnInitDialog()
    {
    CPropertySheet::OnInitDialog();

    CButton* button;

    // Remove the "Apply" button...

    button = (CButton*) GetDlgItem(ID_APPLY_NOW);
    button->DestroyWindow();

    // Remove the "OK" button...

    button = (CButton*) GetDlgItem(IDOK);
    button->DestroyWindow();

    // Remove the "Cancel" button...

    button = (CButton*) GetDlgItem(IDCANCEL);
    button->DestroyWindow();

    // Set the dialog icons...

    SetIcon(m_hIcon, TRUE);

    return TRUE;
    }

    I removed three of the four buttons this way... I think
    that HELP is nice where it is at if you are making an app
    that has the app on one page and the controls on the next
    page.

    Using this method to DestroyWindow() HELP button causes
    errors.

    -Dave

    Reply
  • How to add button into property sheet ??

    Posted by Legacy on 08/21/2001 12:00am

    Originally posted by: zoe

    how to add a new button into property sheet ??
    let say i want to add refresh button

    Reply
  • I didn't have any button

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

    Originally posted by: hugo123

    I created a PropertySheet dialog and add it two dialog. But I have no button apply nor OK. How can I set them visible?

    Reply
  • Loading, Please Wait ...

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

Top White Papers and Webcasts

  • Live Event Date: August 20, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT When you look at natural user interfaces as a developer, it isn't just fun and games. There are some very serious, real-world usage models of how things can help make the world a better place – things like Intel® RealSense™ technology. Check out this upcoming eSeminar and join the panel of experts, both from inside and outside of Intel, as they discuss how natural user interfaces will likely be getting adopted in a wide variety …

  • With 81% of employees using their phones at work, companies have stopped asking: "Is corporate data leaking from personal devices?" and started asking: "How do we effectively prevent corporate data from leaking from personal devices?" The answer has not been simple. ZixOne raises the bar on BYOD security by not allowing email data to reside on the device. In addition, Zix allows employees to maintain complete control of their personal device, therefore satisfying privacy demands of valued employees and the …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds