protected override bool CanHandleShortcut(ShortcutEventArgs e) { if (!this.IsInValidState(true)) { return(false); } Control owner = this.OwnerControl; if (owner == null) { return(false); } Form form = owner.FindForm(); if (form != null) { Form activeForm = e.FocusedControl == null ? Form.ActiveForm : e.FocusedControl.FindForm(); return(form == activeForm); } //no Form, we are on context menu return(true); }
protected override bool CanHandleShortcut(ShortcutEventArgs e) { if (!this.Enabled || !this.IsInValidState(true)) { return(false); } Control ownerControl = this.OwnerControl; if (ownerControl == null) { return(false); } Form form1 = ownerControl.FindForm(); if (form1 != null) { Form form2 = e.FocusedControl == null ? Form.ActiveForm : e.FocusedControl.FindForm(); return(form1 == form2); } RadElement owner = this.Owner as RadElement; if (owner != null && owner.ElementTree != null && owner.ElementTree.Control != null) { Form form2 = owner.ElementTree.Control.FindForm(); if (form2 != null) { Form form3 = e.FocusedControl == null ? Form.ActiveForm : e.FocusedControl.FindForm(); if (form2 != form3) { return(form2.ContainsFocus); } return(true); } } return(true); }