Hello,
I have a CAB application that uses the UltraDockManager. In this application I allow the user to save and load layouts. I offer the user to save his layout if he has made any changes to it before closing the application, something that is done on the Form_Closing event of the main form. This way it is possible for the user to cancel the exiting of the application as well.
My problem is that it seems that the DockingManager is disposed somewhere between when the user presses the 'X' of the window and the event Form_Closing is triggered, so once I ask the user if he wants to save the layout, there is nothing left to save.
How can I save the layout before exiting the application?
Regards, Johan
The TabClosing event on the UltraTabbedMdiManager is fired in response to the Closing event fired on the mdi child Form. The Closing event on a Form is fired just before the FormClosing event. You can override the OnClosing in your mdi child Forms to run code before the TabClosing has a chance to fire, but I'm not really sure why any of the Closing, FormClosing, or TabClosing events are disposing anything. This should not happen until the mdi child is actually closed.
If you want to get to the CloseReason, you must down-cast the event args to the type MdiTabClosingEventArgs.
It would seem like you are on the right track. I'm using a MDIManager working together with my DockManager. This way I can display my DockWorkspaces as Tabs in the Main form. Having looked a bit more on the problem I notice that OnTabbedMdiManagerTabClosing is triggered before I arrive at OnFormClosing, and it is this that disposes my Workspaces. When debugging I can see a property called e.CloseReason, that says 'FormClosed' (which I believe is stretching the truth) but when coding I don't have access to this property. Can you give me code displaying how to distinguish that the Form actually is closing when a tab is closed (because otherwise I want to dispose it).
Is it an mdi application with the dock manager on one of the children? If so, you can probably get around this by handling the FormClosing event of the mdi child rather than the parent. If not, it sounds like a bug and I would recommend submitting the issue to the support group: http://ko.infragistics.com/gethelp.