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
45
Multiple Form Activation Events when using ControlContainerTool
posted

Hi,

In my winforms application I have the situation, that in some cases I receive multiple form activate events,

but no deactivate event. Sounds strange but I can reproduce the problem.

I have an MDI winforms application, which uses the TabbedMdiManager and the ToolbarManager.

The toolbar has several ButtonTools and one ControlContainertTool with a usercontrol. On form's

Activated/Deactivated event I show or hide some tools.

To reproduce the problem, I made a quick&dirty winapp which I have attached. Do the following steps to see

what's wrong:

  • Start the application
  • Click on Tab "Form_Index_0"
  • Click on Tab "Form_Index_1"
  • Click on Tab "Form_Index_2"
  • Check a RadioButton
  • Click on Tab "Form_Index_1"
  • See the output window of visual studio

Here's my output

Form_Index_2 deactivated...
=====================================
Form_Index_0 activated...
Form_Index_0 deactivated...
=====================================
Form_Index_1 activated...
Form_Index_1 deactivated...
=====================================
Form_Index_2 activated...
Form_Index_2 deactivated...
=====================================
Form_Index_0 activated...                           // I didn't activate the first form!!
Form_Index_1 activated...

Something is wrong now, because when I click on Tab "Form_Index_0", I will not receive an activate event. This causes that some tools are still visible but should not.

Is this a bug, or if not, how can I workaround this issue?

It would be great, if somebody could help me.

Thanks in advance,

 

FormActivationBugTest.zip