Hi,
I have attached a sample project, where I need some explanation/help.
Basically we want to initialize configuration values of a certain control pane (and their child-controls) into some ribbon tools (like the name of the pane).
The load-routine is triggered by the PaneActivation event of the docking manager.
This works for docked panes, but if we have a floating pane combined with a docked pane, the activation of panes is confusing.
Following steps on the sample project to reproduce behaviour:
1) Click on the floating panel p2: p1 gets deactivated -> p2 gets activated
2) Click on the textbox tool from the toolbarmanager: p2 gets deactivated -> p1 gets activated -> p1 gets deactivated
-- PaneActivations & PaneDeactivations are logged into Debug-Console --
So why is p1 activated/deactivated when clicking from the activated floating pane p2 into the text toolbox in the ribbon?
Is the activation/deactivation of p1 anyhow avoidable?
Hello,
Thank you for the providing the sample. It was beneficial in verifying exactly what was happening.
In the scenario 2, prior to activating the floating pane (p2), the UltraPanel on the docked pane (p1) is the active control of the form. It remains as the active control on the form even after the floating pane is activated. When the TextBoxTool or any other control on the form (replaced the Ribbon/TextBoxTool with a simple TextBox on the form) is clicked, the floating window loses focus and the main form is activated, which triggers the UltraDockManager to check the active control on the form and if it is inside a DockableControlPane, it activates that pane. This is why the docked pane(p1) which contains the active control (UltraPanel) is activated. The message process then continue to activate the control originally clicked on (TextBoxTool/TextBox) which triggers the docked pane to be deactivated.
I hope this helps to provide a better understanding of the behavior. For what you are doing, you can set the ActiveControl on the main form to null in the PaneActivate event handler, when e.Pane.DockState is Floating. This will prevent the undesired Activate/Deactivate events from occurring. However, this may have other side effects such as when you reactivate the main form via the form's caption, the previously active control will no longer be automatically selected, which is standard .NET behavior.
Let me know if you have any further questions. Thanks,
Chris