mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 07:47:54 +01:00
All tests pass
This commit is contained in:
@@ -2424,19 +2424,30 @@ namespace Terminal.Gui {
|
||||
get => base.Enabled;
|
||||
set {
|
||||
if (base.Enabled != value) {
|
||||
if (value) if (SuperView == null || SuperView?.Enabled == true) base.Enabled = value;
|
||||
else base.Enabled = value;
|
||||
if (!value && HasFocus) SetHasFocus (false, this);
|
||||
if (value) {
|
||||
if (SuperView == null || SuperView?.Enabled == true) {
|
||||
base.Enabled = value;
|
||||
}
|
||||
} else {
|
||||
base.Enabled = value;
|
||||
}
|
||||
if (!value && HasFocus) {
|
||||
SetHasFocus (false, this);
|
||||
}
|
||||
OnEnabledChanged ();
|
||||
SetNeedsDisplay ();
|
||||
|
||||
if (subviews != null) foreach (var view in subviews) if (!value) {
|
||||
if (subviews != null) {
|
||||
foreach (var view in subviews) {
|
||||
if (!value) {
|
||||
view.oldEnabled = view.Enabled;
|
||||
view.Enabled = false;
|
||||
} else {
|
||||
view.Enabled = view.oldEnabled;
|
||||
view.addingView = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1263,6 +1263,7 @@ namespace Terminal.Gui.ViewTests {
|
||||
Assert.True (view.CanFocus);
|
||||
Assert.True (view.HasFocus);
|
||||
|
||||
wasClicked = false;
|
||||
view.Enabled = false;
|
||||
view.ProcessKey (new KeyEvent (Key.Enter, null));
|
||||
Assert.False (wasClicked);
|
||||
|
||||
Reference in New Issue
Block a user