Exemplo n.º 1
0
        private static void DeepGrabFocus(Widget widget)
        {
            Widget widget1 = (Widget)null;

            foreach (Widget focussableWidget in DocumentWindow.GetFocussableWidgets(widget))
            {
                if (focussableWidget.HasFocus)
                {
                    return;
                }
                if (widget1 == null)
                {
                    widget1 = focussableWidget;
                }
            }
            if (widget1 == null)
            {
                return;
            }
            widget1.GrabFocus();
        }
Exemplo n.º 2
0
        private static IEnumerable <Widget> GetFocussableWidgets(Widget widget)
        {
            Container c = widget as Container;

            if (widget.CanFocus)
            {
                yield return(widget);
            }
            if (c != null)
            {
                foreach (Widget widget1 in ((IEnumerable <Widget>)c.FocusChain).SelectMany <Widget, Widget>((Func <Widget, IEnumerable <Widget> >)(x => DocumentWindow.GetFocussableWidgets(x))).Where <Widget>((Func <Widget, bool>)(y => y != null)))
                {
                    yield return(widget1);
                }
            }
        }