SmartPart disappears

Topics: CAB & Smart Client Software Factory
Nov 14, 2007 at 7:34 AM
Hi Guys,

I have modified the WindowWorkspace class so that it captures the Form's 'Closing' event. I want to be able to handle this in a consistent way, so I use this event within child SmartParts that can either cancel (using the CancelEventArgs) or let the close of the WindowWorkspace take place.

However, I am noticing that the SmartPart within the WindowWorkspace is 'disappearing', ie the windowWorkspace's form is still shown, but now the contents of the form have disappeared and I can only see a large blank area where the SmartPart was before. At the time that the SmartPart has disappeared, I have not yet finished handling the 'Closing' event, so it doesn't matter what value I would assign to the CancelEventArgs because the SmartPart has already vanished! I believe something else is causing the SmartPart to disappear, but I do not know what it is.

Can someone please advise in this area?

Thanks!

Regards,
SM
Nov 19, 2007 at 3:59 PM
Hi

The form is still shown because when you set the CancelEvntArgs to True, you are not allowing the execution of the CloseInternal() method (of the Workspace class), which calls the OnClose() method that contains among its lines “form.Close();”. Therefore, the OnClose() method will never be called and the form will not be closed.

There’s a couple of topics that you may like to check out:
Please let me know if this helps.

Ignacio Baumann Fonay
http://staff.southworks.net/blogs/ibaumann/