This project is read-only.

Beginners question - implementing cancel

Topics: User Forum
Jul 27, 2006 at 11:40 AM

Might be a stupid question, since I'm not so experinced with Winforms.

I'm implementing an Application using the NavigationPane.

Foreach NavigationPanePage I have implemented a small application, very much like the way Outlook works.

The functionality I'm working at is when the user selects a new NavigationPanePage, I'll like to prompt the user to save/discard changes.

My problem is that I'll like to user to be able to Cancel the action (to get back and do rework), so basically I'll like to stay on the previous NavigationPanePage (and ignore the fact that the user has selected another NavigationPanePage)
e.g. calling som method in the NavigationPage click handler to ignore further events.

Jul 27, 2006 at 2:44 PM
In beta 2 we added Deselecting as an event on the NavigationPane. If you attach to this event you can use NavigationPaneCancelEventArgs.Cancel parameter to stop the selected button from becoming current.


private void navigationPane1_Deselecting(object sender, Ascend.Windows.Forms.NavigationPaneCancelEventArgs e)
DialogResult result = MessageBox.Show(this, "Do you want to change tabs?", "Test", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

if (result == DialogResult.No)
e.Cancel = true;



You could also just do any actions required for the currently focused button in this event before the new button is set as current and not cancel.

Jul 27, 2006 at 9:02 PM
Thanks for the prompt reply this is exactly what I needed, works now like a charm.

Is is a cool and very easy to use control :-)
Jul 28, 2006 at 3:28 PM
That’s no problem and thank you.