Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CPropertySheet::OnCancel(): Any way to abort the cancellation?

CPropertySheet::OnCancel(): Any way to abort the cancellation?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Robert Mooney
    wrote on last edited by
    #1

    I'm allowing a user to enter data in a wizard, and I want to confirm their intention if they are to click on Cancel. One would think overriding OnCancel, popping up a message box, and then NOT calling the base class method if the user did not intend to quit would be sufficient to keep the property sheet from closing... but this is not the case. Simply return'ing instead of calling the base class method closes the dialog anyway. Is there a way to return to the property sheet? I know something similar can be done with CDialog, which is why the property sheet is confusing. Here is the code:

    // Handle the Cancel button
    void CPageFieldSelection::OnCancel()
    {
    // Confirm
    int result = MessageBox("Are you sure you want to exit?"...);

    // Only cancel if they clicked YES
    if (result != IDYES)
    	return;
    
    CPropertyPage::OnCancel();
    

    }

    The return closes the dialog, as does the CPropertyPage::OnCancel(). :omg: Any help would be appreciated. - Rob

    M 1 Reply Last reply
    0
    • R Robert Mooney

      I'm allowing a user to enter data in a wizard, and I want to confirm their intention if they are to click on Cancel. One would think overriding OnCancel, popping up a message box, and then NOT calling the base class method if the user did not intend to quit would be sufficient to keep the property sheet from closing... but this is not the case. Simply return'ing instead of calling the base class method closes the dialog anyway. Is there a way to return to the property sheet? I know something similar can be done with CDialog, which is why the property sheet is confusing. Here is the code:

      // Handle the Cancel button
      void CPageFieldSelection::OnCancel()
      {
      // Confirm
      int result = MessageBox("Are you sure you want to exit?"...);

      // Only cancel if they clicked YES
      if (result != IDYES)
      	return;
      
      CPropertyPage::OnCancel();
      

      }

      The return closes the dialog, as does the CPropertyPage::OnCancel(). :omg: Any help would be appreciated. - Rob

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      Override CPropertyPage::OnQueryCancel() - that's where you can cancel the cancel operation. :) --Mike-- "Jobs that don't allow you to visit the Lounge 25 times a day at the minimum are not worth having anyway."   -- Nish, 3/28/2002 My really out-of-date homepage Sonork - 100.10414 AcidHelm Big fan of Alyson Hannigan and Jamie Salé.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups