Browse Source

Fixes NumericUpDown resize when number of characters grows.

BDisp 1 year ago
parent
commit
8c617f33f7
1 changed files with 2 additions and 2 deletions
  1. 2 2
      UICatalog/Scenarios/Buttons.cs

+ 2 - 2
UICatalog/Scenarios/Buttons.cs

@@ -420,7 +420,7 @@ public class Buttons : Scenario
 
             // TODO: Use Dim.Auto for the Width and Height
             Height = 1;
-            Width = Dim.Func (() => Digits + 2); // button + 3 for number + button
+            Width = Dim.Func (() => _number is null ? Digits + 2 : Math.Max (Digits + 2, _number.Text.Length + 2)); // button + 3 for number + button
 
             _down = new ()
             {
@@ -438,7 +438,7 @@ public class Buttons : Scenario
                 Text = Value.ToString (),
                 X = Pos.Right (_down),
                 Y = Pos.Top (_down),
-                Width = Dim.Func (() => Digits),
+                Width = Dim.Func (() => _number is null ? Digits : Math.Max (Digits, _number.Text.Length)),
                 Height = 1,
                 TextAlignment = TextAlignment.Centered,
                 CanFocus = true