I am using a PopupControlContainerTool and I've noticed every time it is opened the main application window loses focus (title bar loses focus). This is distracting when the tool is opened several times (lots of tools on my context menu show these popup controls.
I've noticed that the sample app has the same behaviour. Is there a known way to get rid of this behaviour?
The UltraToolbarsManager does not have a way to tell PopupControlContainerTools to not focus their Controls when they are dropped down. If the Control can be focused, an attempt will be made to put focus into that Control. But you may be able to prevent the Control from being focusable. One way is to set either Visible or Enabled to False on the Control, but obviously, this won't work if you want your users to actually interact with the Control. The only other way is to use a custom Control with no child Controls, and which has the Selectable control style turned off. This can be done by calling the following line in your Control's constructor:
this.SetStyle(ControlStyles.Selectable, false);
If you cannot use any of these approaches, you can submit a feature request for a property on the PopupControlContainerTool to prevent it from putting focus into its Control upon dropping down.
Thanks for your reply Mike. There are all sorts of controls on a form that can take focus and not make the main form inactive, so what makes this different? I'm guessing this is something to do with the popup control not being a 'proper' child of the form, and so when it gets focus the form goes inactive.
Interestingly enough we have another application that uses the ribbon toolbar, and does not suffer from the same problem. In fact if I take the BasicFeatures sample project 'out of the box' it suffers from the same problem, if I turn on the ribbon (and place the popup control container tool on the ribbon) the problem goes away.
Yes, the problem is that popups are displayed in their own Forms that are owned by the main Form. When a control on that drop down Form is focused, the drop down Form becomes the active Form and the main Form deactivates.
I'm guessing the same thing is happening with the Ribbon, but it is just not as noticeable due to the rounded Form border displayed by default with the Ribbon. If you set UltraToolbarsManager.FormDisplayStyle to Standard in your Ribbon sample, you will probably see the same behavior you saw in your original application.