From 2ac943f9664c4c2c5ef6ec35fffffe39bb8e1676 Mon Sep 17 00:00:00 2001 From: BDisp Date: Tue, 3 Mar 2020 20:02:56 +0000 Subject: [PATCH 1/4] Fixes #282 "Repaint Issue" --- Terminal.Gui/Views/RadioGroup.cs | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/Terminal.Gui/Views/RadioGroup.cs b/Terminal.Gui/Views/RadioGroup.cs index ab37832fd..c69de08c3 100644 --- a/Terminal.Gui/Views/RadioGroup.cs +++ b/Terminal.Gui/Views/RadioGroup.cs @@ -42,15 +42,20 @@ namespace Terminal.Gui { /// The item to be selected, the value is clamped to the number of items. public RadioGroup (string [] radioLabels, int selected = 0) : base () { - var r = MakeRect (0, 0, radioLabels); - Width = r.Width; - Height = radioLabels.Length; + SetWidthHeight(radioLabels); this.selected = selected; this.radioLabels = radioLabels; CanFocus = true; } + private void SetWidthHeight(string[] radioLabels) + { + var r = MakeRect(0, 0, radioLabels); + Width = r.Width; + Height = radioLabels.Length; + } + static Rect MakeRect (int x, int y, string [] radioLabels) { int width = 0; @@ -81,6 +86,7 @@ namespace Terminal.Gui { public string [] RadioLabels { get => radioLabels; set { + Update(value); radioLabels = value; selected = 0; cursor = 0; @@ -88,9 +94,21 @@ namespace Terminal.Gui { } } + private void Update(string [] newRadioLabels) + { + for (int i = 0; i < radioLabels.Length; i++) { + Move(0, i); + Driver.SetAttribute(ColorScheme.Normal); + Driver.AddStr(new string(' ', radioLabels[i].Length + 4)); + } + if (newRadioLabels.Length != radioLabels.Length) { + SetWidthHeight(newRadioLabels); + } + } + public override void Redraw (Rect region) { - base.Redraw (region); + base.Redraw (region); for (int i = 0; i < radioLabels.Length; i++) { Move (0, i); Driver.SetAttribute (ColorScheme.Normal); From 2afed725d46d3705703570b09c30b42e83c6aad1 Mon Sep 17 00:00:00 2001 From: BDisp Date: Wed, 4 Mar 2020 12:24:29 +0000 Subject: [PATCH 2/4] Removed white space --- Terminal.Gui/Views/RadioGroup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Terminal.Gui/Views/RadioGroup.cs b/Terminal.Gui/Views/RadioGroup.cs index c69de08c3..33a06d7ab 100644 --- a/Terminal.Gui/Views/RadioGroup.cs +++ b/Terminal.Gui/Views/RadioGroup.cs @@ -108,7 +108,7 @@ namespace Terminal.Gui { public override void Redraw (Rect region) { - base.Redraw (region); + base.Redraw (region); for (int i = 0; i < radioLabels.Length; i++) { Move (0, i); Driver.SetAttribute (ColorScheme.Normal); From cbd4fcffd83085eefaf69d81bb10763e9796dfbe Mon Sep 17 00:00:00 2001 From: BDisp Date: Sun, 8 Mar 2020 10:22:41 +0000 Subject: [PATCH 3/4] Fetch from upstream/master --- Designer/Designer.csproj | 2 +- Example/Example.csproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Designer/Designer.csproj b/Designer/Designer.csproj index e87bd0a6b..4374b4802 100644 --- a/Designer/Designer.csproj +++ b/Designer/Designer.csproj @@ -52,4 +52,4 @@ - + \ No newline at end of file diff --git a/Example/Example.csproj b/Example/Example.csproj index 3f6523667..95808f859 100644 --- a/Example/Example.csproj +++ b/Example/Example.csproj @@ -1,4 +1,4 @@ - + Debug @@ -52,4 +52,4 @@ - + \ No newline at end of file From 68aa257936bcbcfc0e2288b229cd5d4f79793ca3 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Mon, 9 Mar 2020 14:30:15 -0400 Subject: [PATCH 4/4] Prepare for 0.70 --- Terminal.Gui/Terminal.Gui.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Terminal.Gui/Terminal.Gui.csproj b/Terminal.Gui/Terminal.Gui.csproj index 8dee18aa1..2f42588eb 100644 --- a/Terminal.Gui/Terminal.Gui.csproj +++ b/Terminal.Gui/Terminal.Gui.csproj @@ -9,7 +9,7 @@ true Terminal.Gui - 0.65 + 0.70 Miguel de Icaza MIT https://github.com/migueldeicaza/gui.cs/ @@ -18,7 +18,7 @@ Miguel de Icaza Application framework for creating modern console applications using .NET Gui.cs is a framework for creating console user interfaces - 0.25: Added new TimeField from Jörg Preiß; Fixes for Backtab by Martin Björkström; ListView now supports simple selection; Bug fixes by giladlevi, Daniel Cazzulino and Marius Ungureanu; New Application.Run of T entry point by Daniel Cazzulino; Added various View methods to bring forward, backwards and move views in the hierarchy; Switch to Portable PDBs by Daniel Cazzulino; Dims can now be compared by Daniel Cazzulino; OnMenuOpen handler by giladlevi; Various memory usage optimizations by giladlevi; FileDialog.FilePath is now a full path by Yanwei Wang; ISupportInitialize/ISupportInitializeNotification is now supported thanks to the work from Daniel Cazzulino; Support for non-modal TopLevels by Daniel Cazzulino and Adrian Alonso; 0.24: the Windows driver implements WakeUp, allowing some scenarios like bug #207 to be fixed; + 0.70: Bug fixes (320, 321, 306, 304, 291, 299, 303); Surface ListView.ListWrapper, surface various internal methods for use in ListView; Allow list item selection; ; 0.65: Added new TimeField from Jörg Preiß; Fixes for Backtab by Martin Björkström; ListView now supports simple selection; Bug fixes by giladlevi, Daniel Cazzulino and Marius Ungureanu; New Application.Run of T entry point by Daniel Cazzulino; Added various View methods to bring forward, backwards and move views in the hierarchy; Switch to Portable PDBs by Daniel Cazzulino; Dims can now be compared by Daniel Cazzulino; OnMenuOpen handler by giladlevi; Various memory usage optimizations by giladlevi; FileDialog.FilePath is now a full path by Yanwei Wang; ISupportInitialize/ISupportInitializeNotification is now supported thanks to the work from Daniel Cazzulino; Support for non-modal TopLevels by Daniel Cazzulino and Adrian Alonso; 0.24: the Windows driver implements WakeUp, allowing some scenarios like bug #207 to be fixed; 0.23: Better support for disabled menu items; Raises text changed event after the internals have been updated; Fix Caps-NumLock; Alt-HotKey now work on menus 0.22: Correct vertical scrollview behavior, Small curses driver fix for terminals without mouse support, TextView support for scrolling, Surface Used property on TextField, Surface Cursor on RadioGroup.