Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using the Cancel Button
Message
 
À
18/04/2005 13:44:57
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01005881
Message ID:
01006828
Vues:
20
Lori,

>I have recently added the Cancel button to our directory forms. I've added code to the HookPreCancel of the form, to prompt the user: "Do you want to cancel changes?" I'm having a problem with this. On this same form, if I make changes, and immediately hit Exit, it prompts me: "Do you want to save changes?" If I click NO, then it fires my HookPreCancel() and I'm prompted again: "Do you want to cancel changes?" I only want the the my HookPreCancel code to fire when the user is actually hitting Cancel. When the user hits Exit, it is set up in mmBusinessForm to fire Cancel() which down the path, fires my HookPreCancel(), prompting the user twice. Are there any suggestions on getting around this?

The reason you're seeing the dialog when you say "No" to "Do you want to save changes?" is because the form's Cancel method is subsequently called (and in turn your HookPreCancel() method.

I have an alternate suggestion to accomplish your goal. I recommend subclassing the mmButtonCancel button and overriding the mmButtonCancel_Click() method. You can display your dialog, and if the user selects to Cancel changes, you can call the base class method.

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform