Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
725
Canceling Tab Change - UltraWinTabControl
posted

Maybe this is not the correct control to do what I'm trying to do, but ..

I have an UltraWinTabControl with several tabs on the top of my form, the bottom of my form is an UltraWinGrid.

I am using the .ActiveTabChanged event to set the datasource of the Grid based on the ActiveTabChangedEventArgs Tab.Key property.

What I am looking for is a means to see what tab I am leaving BEFORE I leave it because I would like to:

1) check that the grid data has been saved, and cancel the tab change if not.

2) Save any user applied filters to the grid for that tab to re-apply when the tab becomes active again

I cannot seem to find any means to do this BEFORE the actual change happens.

The ActiveTabChangedEventArgs  has a .PreviousTab property but by the time this event fires, the change is completed and it has no .Cancel property

 

The ActiveTabChangingEventArgs has a .Cancel property but the .Tab property still points to the tab it's changing into not the one it's leaving and it has no .PreviousTab property.

I suppose I could do everything in the AfterTabChanged event and then switch back to the .PreviousTab if it fails but the fact that .ActiveTabChanging has a .Cancel property makes me think there should be a cleaner / simpler way to do this.

Am I missing something or is there a better way to handle this?

Thanks

Steve

Parents
No Data
Reply
  • 34810
    Verified Answer
    Offline posted

    Hello Steve,

    I have been investigating into your requirement, and I would recommend that you continue with the ActiveTabChanging event in this case.

    The reason that the event arguments of the ActiveTabChanging event does not have a PreviousTab property is because when this event fires, the ActiveTab property of the UltraTabControl has not yet changed. As such, you can get this “previous tab” from the ActiveTab property of the UltraTabControl.

    Please let me know if you have any other questions or concerns on this matter.

Children