开发者

How do I implement user confirmation of exit on an MDI parent form?

开发者 https://www.devze.com 2023-02-17 04:54 出处:网络
We have an MDI form with multiple childr开发者_如何学Pythonen, plus the standard close window button in the title bar, and an additional control for the same.

We have an MDI form with multiple childr开发者_如何学Pythonen, plus the standard close window button in the title bar, and an additional control for the same.

We were using the parent's FormClosing event handler to get user confirmation of the exit before continuing, but have just discovered that the child windows get closed before this is run. We only want a single confirmation message box, but I guess that would require the child windows to ask the parent to confirm.

Has anyone got a clean solution to this or shall I go with my hunch?


Sounds like your hunch is about right, The only improvement I can think of might be to wrap each of the child forms in a facade when it's created, and that facade could then vector the child close event back out to the parent for verification (only once).

You could also use delegates, but I think a facade would be cleaner.

0

精彩评论

暂无评论...
验证码 换一张
取 消