internal void SendControlFocus(Control c) { if (c != null && c.IsHandleCreated) { XplatUI.SetFocus(c.window.Handle); } }
internal void FocusActiveControlInternal() { if (active_control != null && active_control.Visible) { // Avoid focus loops, especially with ComboBoxes, on Win98/ME. IntPtr focusHandle = XplatUI.GetFocus(); if (focusHandle == IntPtr.Zero || Control.FromChildHandle(focusHandle) != active_control) { XplatUI.SetFocus(active_control.Handle); } } else { // Determine and focus closest visible parent ContainerControl cc = this; while (cc != null && !cc.Visible) { Control parent = cc.Parent; if (parent != null) { cc = parent.GetContainerControl() as ContainerControl; } else { break; } } if (cc != null && cc.Visible) { XplatUI.SetFocus(cc.Handle); } } }
protected override void WndProc(ref Message m) { if (m.Msg == (int)Msg.WM_SETFOCUS) { if (m.WParam != IntPtr.Zero) { XplatUI.SetFocus(m.WParam); } } base.WndProc(ref m); }