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
958
What is the TabCloseAction in TabClosing() for?
posted

Dear community,

In the code sample of the help topic about the TabClosing() event is the following code

           if (e.Tab.SettingsResolved.TabCloseAction == MdiTabCloseAction.Close)
           {
               
if (e.Tab.Form is
EditForm)
               {
                   
if
(! ((EditForm)e.Tab.Form).Save() )
                       e.Cancel = true;
               }
           }

I wonder what the TabCloseAction is for? Why that comparison with MdiTabCloseAction.Close?

Best regards, Gerald

  • 44743
    Verified Answer
    posted

    On the SettingsResolved, the TabCloseAction can have the values None, Hide, or Close. These indicate what will happen to the Form on the tab when the tab is closed. None indicates the Form and tab will remain open. Hide indicates the Form and tab will be hidden, but can be shown again later. However, Close indicates the Form will be closed, so in the code snippet above, if the Form would be closing, the code asks the user if they want to save the form before closing.