예제 #1
0
        internal static void SetFocus(Gtk.Widget w)
        {
            w.ChildFocus(Gtk.DirectionType.Down);

            Gtk.Window win = w.Toplevel as Gtk.Window;
            if (win == null)
            {
                return;
            }

            // Make sure focus is not given to internal children
            if (win.Focus != null)
            {
                Gtk.Container c = win.Focus.Parent as Gtk.Container;
                if (c.Children.Length == 0)
                {
                    win.Focus = c;
                }
            }
        }