+2007-08-20 Jonathan Pobst <monkey@jpobst.com>
+
+ * ToolStrip.cs: Add some logic to un-focus controls in ToolStripControlHosts
+ when other buttons are clicked or navigated to.
+
2007-08-20 Rolf Bjarne Kvinge <RKvinge@novell.com>
* XplatUIX11.cs: Treat toolwindows as if they had no window manager, since
{
if (mouse_currently_over != null)
{
+ ToolStripItem focused = GetCurrentlyFocusedItem ();
+
+ if (focused != null && focused != mouse_currently_over)
+ this.FocusInternal (true);
+
if (this is MenuStrip && !(mouse_currently_over as ToolStripMenuItem).HasDropDownItems) {
if (!menu_selected)
(this as MenuStrip).FireMenuActivate ();
foreach (ToolStripItem tsi in this.Items)
if (tsi != nextItem)
tsi.Dismiss (ToolStripDropDownCloseReason.Keyboard);
-
+
+ ToolStripItem current = GetCurrentlySelectedItem ();
+
+ if (!(current is ToolStripControlHost))
+ this.FocusInternal (true);
+
+ if (nextItem is ToolStripControlHost)
+ (nextItem as ToolStripControlHost).Focus ();
+
nextItem.Select ();
if (nextItem.Parent is MenuStrip && (nextItem.Parent as MenuStrip).MenuDroppedDown)
return null;
}
+ internal ToolStripItem GetCurrentlyFocusedItem ()
+ {
+ foreach (ToolStripItem tsi in this.DisplayedItems)
+ if ((tsi is ToolStripControlHost) && (tsi as ToolStripControlHost).Control.Focused)
+ return tsi;
+
+ return null;
+ }
+
internal virtual Size GetToolStripPreferredSize (Size proposedSize)
{
Size new_size = new Size (0, this.Height);