private Control GetFocusedControl() { Control control = (Control)null; IntPtr focus = RadPopupContainerForm.GetFocus(); if (focus != IntPtr.Zero) { control = Control.FromHandle(focus); } return(control); }
private static RadPopupContainerForm.KeyStates GetKeyState(Keys key) { RadPopupContainerForm.KeyStates keyStates = RadPopupContainerForm.KeyStates.None; short keyState = RadPopupContainerForm.GetKeyState((int)key); if (((int)keyState & 32768) == 32768) { keyStates |= RadPopupContainerForm.KeyStates.Down; } if (((int)keyState & 1) == 1) { keyStates |= RadPopupContainerForm.KeyStates.Toggled; } return(keyStates); }
protected virtual void SetFocusCore() { bool forward = !RadPopupContainerForm.IsKeyDown(Keys.LShiftKey) && !RadPopupContainerForm.IsKeyDown(Keys.RShiftKey); Control ctl = this.GetFocusedControl(); do { if (!forward && ctl is System.Windows.Forms.TextBox && ctl.Parent is RadControl) { ctl = ctl.Parent; } ctl = this.panel.GetNextControl(ctl, forward); }while (ctl != null && !ctl.CanSelect); if (ctl == null || !ctl.CanFocus) { return; } if (ctl is RadTextBox) { ctl = ((RadTextBoxBase)ctl).TextBoxItem.HostedControl; } ctl.Focus(); }
public static bool IsKeyDown(Keys key) { return(RadPopupContainerForm.KeyStates.Down == (RadPopupContainerForm.GetKeyState(key) & RadPopupContainerForm.KeyStates.Down)); }