Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs/class
diff options
context:
space:
mode:
authorKarl <5079870+PreferLinux@users.noreply.github.com>2020-01-13 19:11:38 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2020-01-13 19:11:38 +0300
commit7a8242ed362ae1176d5c38cbe5287b7332490d63 (patch)
tree394a49c3f8bea5d9fb052787e872e51fd7cb0963 /mcs/class
parentd7e84ac6d18d84d8072ad45b87932b0353f05192 (diff)
[Winforms] Don't have non-active controls focused (#18426)
- Make the state of Control.CanSelect depend on whether the control is visible and enabled. - When setting Control.Visible to false, if this control is focused, move the focus to the next control.
Diffstat (limited to 'mcs/class')
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs5
1 files changed, 5 insertions, 0 deletions
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs
index ae2526aa514..358533d121b 100644
--- a/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs
@@ -2267,6 +2267,9 @@ namespace System.Windows.Forms
return false;
}
+ if (!is_visible || !is_enabled)
+ return false;
+
parent = this;
while (parent != null) {
if (!parent.is_visible || !parent.is_enabled) {
@@ -4838,6 +4841,8 @@ namespace System.Windows.Forms
XplatUI.SetVisible (Handle, is_visible, true);
if (!is_visible) {
if (parent != null && parent.IsHandleCreated) {
+ if (InternalContainsFocus)
+ parent.SelectNextControl(this, true, true, true, true);
parent.Invalidate (bounds);
parent.Update ();
} else {