DocumentContainerCloseButtonClicked

Docking/MDI for Windows Forms Forum

Posted 18 years ago by Michael Knorr
Version: 2.0.70
Avatar
Hello,

I'm just updating from the old "DockableWindows" product to the new "UIStudio". All in all this went quite smooth. For most features I easily found the corresponding class/event/method in the new product.

In DockableWindows I subscribed to the "DocumentContainerCloseButtonClicked" event, to ask the user if he wants to save the document before closing. In "UIStudio" I could use the "WindowsClosing"-event. Unfortunately, this event is raised whenever a window is closed and I don't have the information why it is raised. How can I find out if the window is closing, because the close-button was clicked or if it is closing because "Close" was called, the program closes, etc...?

UseCase:
When a document is closed via the close button the user is asked if he wants to save it. When the program is closed the document is saved to a special area and when the program is opened again the document is loaded from this area, so the user can continue working. Therefore I need to differentiate these cases.

Regards,
Michael Knorr

Comments (3)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
We're glad to hear that the transition went smoothly.

I'll add an item to the TODO list for you on this. We must have missed that feature when going through and making sure UIStudio had everything DockableWindow had.

As a workaround could you implement OnClosing in your Form and set a Form-level flag that indicates the Form is closing? Then in your WindowClosing code, check to see if that flag is set to determine which action to take. Would that work?


Actipro Software Support

Posted 18 years ago by Michael Knorr
Avatar
Setting a flag when the program closes should work. I just wasnt sure if the event was moved/renamed and I overlooked it.
Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Michael,

Ok, these additions/changes have been made for the next maintenance release:
  • Added the TabbedMdiWindowCloseReason enumeration.
  • Added an overload to TabbedMdiWindow.Close that accepts a TabbedMdiWindowCloseReason parameter.
  • Added overloads to the CloseAllActiveDocuments, CloseAllActiveToolWindows, and CloseAllButSelectedActiveDocuments methods of the DockManager class that accept a TabbedMdiWindowCloseReason parameter.
  • Added the TabbedMdiWindowClosingEventArgs.Reason property, which indicates why the window is being closed in the DockManager.WindowClosing event.
  • Added the TabbedMdiWindowClosingEventArgs class and TabbedMdiWindowClosingEventHandler delegate.
[Modified at 10/20/2006 03:03 PM]


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.