Added Applicaton.ClearScreenNextIteration

This commit is contained in:
Tig
2024-11-25 20:17:04 -07:00
parent 68daff5dd9
commit d39a940955
4 changed files with 24 additions and 1 deletions

View File

@@ -505,6 +505,11 @@ public static partial class Application // Run (Begin, Run, End, Stop)
{
bool neededLayout = View.Layout (TopLevels.Reverse (), Screen.Size);
if (ClearScreenNextIteration)
{
forceDraw = true;
ClearScreenNextIteration = false;
}
if (forceDraw)
{
Driver?.ClearContents ();

View File

@@ -67,4 +67,13 @@ public static partial class Application // Screen related stuff
return true;
}
/// <summary>
/// Gets or sets whether the screen will be cleared, and all Views redrawn, during the next Application iteration.
/// </summary>
/// <remarks>
/// This is typicall set to true when a View's <see cref="View.Frame"/> changes and that view has no
/// SuperView (e.g. when <see cref="Application.Top"/> is moved or resized.
/// </remarks>
public static bool ClearScreenNextIteratio { get; set; }
}

View File

@@ -215,6 +215,8 @@ public static partial class Application
Navigation = null;
ClearScreenNextIteration = false;
AddApplicationKeyBindings ();
// Reset synchronization context to allow the user to run async/await,

View File

@@ -557,7 +557,14 @@ public partial class View // Layout APIs
SetTitleTextFormatterSize ();
}
SuperView?.SetNeedsDraw ();
if (SuperView is { })
{
SuperView?.SetNeedsDraw ();
}
else
{
// Application.ClearScreenNextIteration = true;
}
}
if (TextFormatter.ConstrainToWidth is null)