public void FocusPreviousControl() { IFocusableControl prevControl = GetNextFocusableControl(false); if (prevControl != null) { prevControl.Focus(); } }
public void FocusNextControl() { IFocusableControl nextControl = GetNextFocusableControl(true); if (nextControl != null) { nextControl.Focus(); } }
public void moveFocusToControl(IFocusableControl control) { EventHorizonBlazorInterop.Func <CachedEntity>( new object[] { new string[] { this.___guid, "moveFocusToControl" }, control } ); }
/// <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); }
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); }
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; }
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; }
public void AddControl(IFocusableControl control) { _focusControlList.Add(control); }
public void RemoveControl(IFocusableControl control) { _focusControlList.Remove(control); }
public void SetFocus(IFocusableControl control) { FocusedControl = control; }
/// <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; } }
/// <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); }