Пример #1
0
        public void FocusPreviousControl()
        {
            IFocusableControl prevControl = GetNextFocusableControl(false);

            if (prevControl != null)
            {
                prevControl.Focus();
            }
        }
Пример #2
0
        public void FocusNextControl()
        {
            IFocusableControl nextControl = GetNextFocusableControl(true);

            if (nextControl != null)
            {
                nextControl.Focus();
            }
        }
Пример #3
0
 public void moveFocusToControl(IFocusableControl control)
 {
     EventHorizonBlazorInterop.Func <CachedEntity>(
         new object[]
     {
         new string[] { this.___guid, "moveFocusToControl" }, control
     }
         );
 }
Пример #4
0
 /// <summary>
 ///   Implements <see cref="M:Remotion.Web.UI.ISmartNavigablePage.SetFocus(Remotion.Web.UI.Controls.IFocusableControl)">ISmartNavigablePage.SetFocus(IFocusableControl)</see>.
 /// </summary>
 public void SetFocus(IFocusableControl control)
 {
     ArgumentUtility.CheckNotNull("control", control);
     if (string.IsNullOrEmpty(control.FocusID))
     {
         return;
     }
     SetFocus(control.FocusID);
 }
Пример #5
0
        private int GetFocusedControlIndex()
        {
            if (_focusControlList.Count == 0)
            {
                return(-1);
            }

            for (int i = 0; i < _focusControlList.Count; i++)
            {
                IFocusableControl control = (IFocusableControl)_focusControlList[i];
                if (control.ContainsFocus)
                {
                    return(i);
                }
            }
            return(0);
        }
Пример #6
0
        public void ActivateControl(IFocusableControl control)
        {
            if (!control.Focusable)
            {
                return;
            }

            if (!activeControls.ContainsKey(ActiveContainer))
            {
                return;
            }

            var ctrl = activeControls[ActiveContainer];

            if (ctrl != null)
            {
                ctrl.IsFocused = false;
            }

            control.IsFocused = true;
            activeControls[ActiveContainer] = control;
        }
Пример #7
0
        private IFocusableControl GetNextFocusableControl(bool forward)
        {
            int index = GetFocusedControlIndex();

            if (index == -1)
            {
                return(null);
            }
            int nextIndex = GetNextIndex(index, forward);

            while (nextIndex != index)
            {
                IFocusableControl control = (IFocusableControl)_focusControlList[nextIndex];
                if (!control.Visible)
                {
                    nextIndex = GetNextIndex(nextIndex, forward);
                }
                else
                {
                    return(control);
                }
            }
            return(null);
        }
 public void SetFocus(IFocusableControl control)
 {
     _bocList.SetFocusImplementation(control);
 }
 public FocusableControlProxy(IFocusableControl control)
 {
     _control = control;
 }
 protected FocusableControlProxy()
 {
     _control = NullFocusableControl.Instance;
 }
Пример #11
0
 public void AddControl(IFocusableControl control)
 {
     _focusControlList.Add(control);
 }
Пример #12
0
 public void RemoveControl(IFocusableControl control)
 {
     _focusControlList.Remove(control);
 }
Пример #13
0
 protected FocusableControlProxy()
 {
     _control = NullFocusableControl.Instance;
 }
Пример #14
0
 public FocusableControlProxy(IFocusableControl control)
 {
     _control = control;
 }
 public void SetFocus(IFocusableControl control)
 {
     FocusedControl = control;
 }
Пример #16
0
        /// <summary>
        /// navigate back and ford
        /// </summary>
        /// <param name="forward"></param>
        void ControlNavigate(bool forward)
        {
            if (inputListeners.Count == 0)
            {
                return;
            }

            IFocusableControl toFocus = null;

            List <IFocusableControl> focusableControls = new List <IFocusableControl>();

            foreach (var ctrl in inputListeners)
            {
                if (ctrl is IFocusableControl)
                {
                    var fc = (IFocusableControl)ctrl;
                    if (fc.Focusable && fc.Visible && fc.Enabled)
                    {
                        focusableControls.Add((IFocusableControl)ctrl);
                    }
                }
            }

            if (focusableControls.Count > 0)
            {
                // get current active control
                var control = m_focusedControl;

                // not found
                int focusedIndex = control == null ? -1 : control.TabIndex;
                if (focusedIndex == -1)
                {
                    // go to first control
                    toFocus = focusableControls.Count > 0 ? focusableControls[0] : null;
                }
                else
                {
                    // find next focusable control by focus index
                    IFocusableControl navControl = null;
                    if (forward)
                    {
                        navControl = focusableControls.Where(p => p.TabIndex >
                                                             focusedIndex).OrderBy(p => p.TabIndex).FirstOrDefault();
                    }
                    else
                    {
                        navControl = focusableControls.Where(p => p.TabIndex <
                                                             focusedIndex).OrderByDescending(p => p.TabIndex).FirstOrDefault();
                    }

                    if (navControl == null)
                    {
                        // get max focused index and min
                        int maxFocusedIndex = focusableControls.Max(p => p.TabIndex);
                        int minFocusedIndex = focusableControls.Min(p => p.TabIndex);

                        if (minFocusedIndex != maxFocusedIndex)
                        {
                            if (forward)
                            {
                                toFocus = focusableControls.FirstOrDefault(p => p.TabIndex == minFocusedIndex);
                            }
                            else
                            {
                                toFocus = focusableControls.FirstOrDefault(p => p.TabIndex == maxFocusedIndex);
                            }
                        }
                        else
                        {
                            // get next control in list of focuseable contrls
                            var idx = focusableControls.IndexOf(control);
                            if (idx == -1)
                            {
                                toFocus = focusableControls.Count > 0 ? focusableControls[0] : null;
                            }
                            else
                            {
                                if (forward)
                                {
                                    idx = idx == focusableControls.Count - 1 ? 0 : idx + 1;
                                }
                                else
                                {
                                    idx = idx == 0 ? focusableControls.Count - 1 : idx - 1;
                                }

                                toFocus = idx >= 0 && idx < focusableControls.Count ? focusableControls[idx] : null;
                            }
                        }
                    }
                    else
                    {
                        toFocus = navControl;
                    }
                }
            }

            if (toFocus != null)
            {
                this.FocusedControl = toFocus;
            }
        }
Пример #17
0
 /// <summary> Sets the focus to the passed control. </summary>
 /// <param name="control">
 ///   The <see cref="IFocusableControl"/> to assign the focus to. Must no be <see langword="null"/>.
 /// </param>
 public void SetFocus(IFocusableControl control)
 {
     _smartPageInfo.SetFocus(control);
 }
 public void RemoveControl(IFocusableControl control)
 {
     _focusControlList.Remove(control);
 }
 public void AddControl(IFocusableControl control)
 {
     _focusControlList.Add(control);
 }