ソースを参照

Fixed Title event test

Tigger Kindel 2 年 前
コミット
1c5fc2d962
2 ファイル変更10 行追加5 行削除
  1. 9 5
      Terminal.Gui/Core/View.cs
  2. 1 0
      Terminal.Gui/Windows/Wizard.cs

+ 9 - 5
Terminal.Gui/Core/View.cs

@@ -554,13 +554,17 @@ namespace Terminal.Gui {
 		public ustring Title {
 			get => title;
 			set {
-				title = value;
-				SetNeedsDisplay ();
+				if (!OnTitleChanging (title, value)) {
+					var old = title;
+					title = value;
+					SetNeedsDisplay ();
 #if DEBUG
-				if (title != null && string.IsNullOrEmpty (Id)) {
-					Id = title.ToString ();
+					if (title != null && string.IsNullOrEmpty (Id)) {
+						Id = title.ToString ();
+					}
+#endif // DEBUG
+					OnTitleChanged (old, title);
 				}
-#endif
 			}
 		}
 

+ 1 - 0
Terminal.Gui/Windows/Wizard.cs

@@ -78,6 +78,7 @@ namespace Terminal.Gui {
 			/// </summary>
 			/// <remarks>The Title is only displayed when the <see cref="Wizard"/> is used as a modal pop-up (see <see cref="Wizard.Modal"/>.</remarks>
 			public new ustring Title {
+				// BUGBUG: v2 - No need for this as View now has Title w/ notifications.
 				get => title;
 				set {
 					if (!OnTitleChanging (title, value)) {