diff --git a/Example/demo.cs b/Example/demo.cs
index edae3a77b..ed97a84b1 100644
--- a/Example/demo.cs
+++ b/Example/demo.cs
@@ -30,7 +30,7 @@ static class Demo {
throw new NotImplementedException ();
}
- public override void Redraw (Rect region)
+ public override void Redraw (Rect bounds)
{
//Point pos = new Point (region.X, region.Y);
Driver.SetAttribute (ColorScheme.Focus);
@@ -53,7 +53,7 @@ static class Demo {
{
}
- public override void Redraw (Rect region)
+ public override void Redraw (Rect bounds)
{
Driver.SetAttribute (ColorScheme.Focus);
var f = Frame;
diff --git a/Terminal.Gui/Core/ConsoleDriver.cs b/Terminal.Gui/Core/ConsoleDriver.cs
index 088e14ae7..fb3015893 100644
--- a/Terminal.Gui/Core/ConsoleDriver.cs
+++ b/Terminal.Gui/Core/ConsoleDriver.cs
@@ -5,7 +5,7 @@
// Miguel de Icaza (miguel@gnome.org)
//
// Define this to enable diagnostics drawing for Window Frames
-#define DRAW_WINDOW_FRAME_DIAGNOSTICS
+//#define DRAW_WINDOW_FRAME_DIAGNOSTICS
using NStack;
using System;
using System.Runtime.CompilerServices;
diff --git a/Terminal.Gui/Core/Toplevel.cs b/Terminal.Gui/Core/Toplevel.cs
index 31a3f49b6..bb647bf21 100644
--- a/Terminal.Gui/Core/Toplevel.cs
+++ b/Terminal.Gui/Core/Toplevel.cs
@@ -257,18 +257,18 @@ namespace Terminal.Gui {
}
///
- public override void Redraw (Rect region)
+ public override void Redraw (Rect bounds)
{
Application.CurrentView = this;
if (IsCurrentTop || this == Application.Top) {
if (NeedDisplay != null && !NeedDisplay.IsEmpty) {
Driver.SetAttribute (Colors.TopLevel.Normal);
- Clear (region);
+ Clear (bounds);
Driver.SetAttribute (Colors.Base.Normal);
}
foreach (var view in Subviews) {
- if (view.Frame.IntersectsWith (region)) {
+ if (view.Frame.IntersectsWith (bounds)) {
view.SetNeedsLayout ();
view.SetNeedsDisplay (view.Bounds);
}
diff --git a/Terminal.Gui/Core/View.cs b/Terminal.Gui/Core/View.cs
index ff985e8e0..cef542eba 100644
--- a/Terminal.Gui/Core/View.cs
+++ b/Terminal.Gui/Core/View.cs
@@ -618,7 +618,7 @@ namespace Terminal.Gui {
}
///
- /// Converts a view-relative (col,row) position to a screen-relative positino (col,row). The values are optionally clamped to the screen dimensions.
+ /// Converts a view-relative (col,row) position to a screen-relative position (col,row). The values are optionally clamped to the screen dimensions.
///
/// View-relative column.
/// View-relative row.
@@ -660,11 +660,13 @@ namespace Terminal.Gui {
}
}
- // Converts a rectangle in view-relative coordinates to screen-relative coordinates.
- internal Rect RectToScreen (Rect rect)
+ ///
+ /// Converts a region in view-relative coordinates to screen-relative coordinates.
+ ///
+ internal Rect ViewToScreen (Rect region)
{
- ViewToScreen (rect.X, rect.Y, out var x, out var y, clipped: false);
- return new Rect (x, y, rect.Width, rect.Height);
+ ViewToScreen (region.X, region.Y, out var x, out var y, clipped: false);
+ return new Rect (x, y, region.Width, region.Height);
}
// Clips a rectangle in screen coordinates to the dimensions currently available on the screen
@@ -697,9 +699,8 @@ namespace Terminal.Gui {
/// View-relative clip region.
public Rect SetClip (Rect region)
{
- var bscreen = RectToScreen (region);
var previous = Driver.Clip;
- Driver.Clip = ScreenClip (RectToScreen (Bounds));
+ Driver.Clip = Rect.Intersect (previous, ViewToScreen (region));
return previous;
}
@@ -711,7 +712,7 @@ namespace Terminal.Gui {
/// If set to true it fill will the contents.
public void DrawFrame (Rect region, int padding = 0, bool fill = false)
{
- var scrRect = RectToScreen (region);
+ var scrRect = ViewToScreen (region);
var savedClip = ClipToBounds ();
Driver.DrawFrame (scrRect, padding, fill);
Driver.Clip = savedClip;
@@ -910,7 +911,7 @@ namespace Terminal.Gui {
///
/// Redraws this view and its subviews; only redraws the views that have been flagged for a re-display.
///
- /// The view-relative region to redraw.
+ /// The view-relative region to redraw.
///
///
/// Views should set the color that they want to use on entry, as otherwise this will inherit
@@ -921,28 +922,24 @@ namespace Terminal.Gui {
/// larger than the region parameter.
///
///
- public virtual void Redraw (Rect region)
+ public virtual void Redraw (Rect bounds)
{
var clipRect = new Rect (Point.Empty, frame.Size);
if (subviews != null) {
foreach (var view in subviews) {
if (view.NeedDisplay != null && (!view.NeedDisplay.IsEmpty || view.childNeedsDisplay)) {
- if (view.Frame.IntersectsWith (clipRect) && view.Frame.IntersectsWith (region)) {
+ if (view.Frame.IntersectsWith (clipRect) && view.Frame.IntersectsWith (bounds)) {
// FIXED: optimize this by computing the intersection of region and view.Bounds
if (view.layoutNeeded)
view.LayoutSubviews ();
Application.CurrentView = view;
- // Ensure we don't make the Driver's clip rect any bigger
- if (Driver.Clip.IsEmpty || Driver.Clip.Contains(RectToScreen (view.Frame))) {
- var savedClip = view.ClipToBounds ();
- view.Redraw (view.Bounds);
- Driver.Clip = savedClip;
- } else {
- view.Redraw (view.Bounds);
- }
+ // Clip the sub-view
+ var savedClip = ClipToBounds ();
+ view.Redraw (view.Bounds);
+ Driver.Clip = savedClip;
}
view.NeedDisplay = Rect.Empty;
view.childNeedsDisplay = false;
diff --git a/Terminal.Gui/Core/Window.cs b/Terminal.Gui/Core/Window.cs
index 62fa66c1d..2bf4d4bf1 100644
--- a/Terminal.Gui/Core/Window.cs
+++ b/Terminal.Gui/Core/Window.cs
@@ -29,7 +29,7 @@ namespace Terminal.Gui {
public ContentView (Rect frame) : base (frame) { }
public ContentView () : base () { }
#if false
- public override void Redraw (Rect region)
+ public override void Redraw (Rect bounds)
{
Driver.SetAttribute (ColorScheme.Focus);
@@ -159,7 +159,7 @@ namespace Terminal.Gui {
{
//var padding = 0;
Application.CurrentView = this;
- var scrRect = RectToScreen (new Rect (0, 0, Frame.Width, Frame.Height));
+ var scrRect = ViewToScreen (new Rect (0, 0, Frame.Width, Frame.Height));
// BUGBUG: Why do we draw the frame twice? This call is here to clear the content area, I think. Why not just clear that area?
if (NeedDisplay != null && !NeedDisplay.IsEmpty) {
@@ -167,13 +167,10 @@ namespace Terminal.Gui {
Driver.DrawFrame (scrRect, padding, true);
}
- if (Driver.Clip.IsEmpty || Driver.Clip.Contains (contentView.RectToScreen (contentView.Frame))) {
- var savedClip = ClipToBounds ();
- contentView.Redraw (contentView.Bounds);
- Driver.Clip = savedClip;
- } else {
- contentView.Redraw (contentView.Bounds);
- }
+ var savedClip = ClipToBounds ();
+ contentView.Redraw (contentView.Bounds);
+ Driver.Clip = savedClip;
+
ClearNeedsDisplay ();
Driver.SetAttribute (ColorScheme.Normal);
Driver.DrawFrame (scrRect, padding, false);
@@ -204,7 +201,7 @@ namespace Terminal.Gui {
if (dragPosition.HasValue) {
if (SuperView == null) {
Application.Top.SetNeedsDisplay (Frame);
- Application.Top.Redraw (Frame);
+ Application.Top.Redraw (Bounds);
} else {
SuperView.SetNeedsDisplay (Frame);
}
diff --git a/Terminal.Gui/Views/Button.cs b/Terminal.Gui/Views/Button.cs
index 54298d093..7013079dc 100644
--- a/Terminal.Gui/Views/Button.cs
+++ b/Terminal.Gui/Views/Button.cs
@@ -152,7 +152,7 @@ namespace Terminal.Gui {
}
///
- public override void Redraw (Rect region)
+ public override void Redraw (Rect bounds)
{
Driver.SetAttribute (HasFocus ? ColorScheme.Focus : ColorScheme.Normal);
Move (0, 0);
diff --git a/Terminal.Gui/Views/Checkbox.cs b/Terminal.Gui/Views/Checkbox.cs
index 056846b40..57421db73 100644
--- a/Terminal.Gui/Views/Checkbox.cs
+++ b/Terminal.Gui/Views/Checkbox.cs
@@ -98,7 +98,7 @@ namespace Terminal.Gui {
}
///
- public override void Redraw (Rect region)
+ public override void Redraw (Rect bounds)
{
Driver.SetAttribute (HasFocus ? ColorScheme.Focus : ColorScheme.Normal);
Move (0, 0);
diff --git a/Terminal.Gui/Views/FrameView.cs b/Terminal.Gui/Views/FrameView.cs
index a08646ba0..bbd7b1bbe 100644
--- a/Terminal.Gui/Views/FrameView.cs
+++ b/Terminal.Gui/Views/FrameView.cs
@@ -136,20 +136,24 @@ namespace Terminal.Gui {
{
var padding = 0;
Application.CurrentView = this;
- var scrRect = RectToScreen (new Rect (0, 0, Frame.Width, Frame.Height));
+ var scrRect = ViewToScreen (new Rect (0, 0, Frame.Width, Frame.Height));
if (NeedDisplay != null && !NeedDisplay.IsEmpty) {
Driver.SetAttribute (ColorScheme.Normal);
Driver.DrawFrame (scrRect, padding, true);
}
- if (Driver.Clip.IsEmpty || Driver.Clip.Contains (contentView.RectToScreen (contentView.Frame))) {
- var savedClip = ClipToBounds ();
- contentView.Redraw (contentView.Bounds);
- Driver.Clip = savedClip;
- } else {
- contentView.Redraw (contentView.Bounds);
- }
+ var savedClip = ClipToBounds ();
+ contentView.Redraw (contentView.Bounds);
+ Driver.Clip = savedClip;
+
+ //if (Driver.Clip.IsEmpty || Driver.Clip.Contains (ViewToScreen (contentView.Frame))) {
+ // var savedClip = ClipToBounds ();
+ // contentView.Redraw (contentView.Bounds);
+ // Driver.Clip = savedClip;
+ //} else {
+ // contentView.Redraw (contentView.Bounds);
+ //}
ClearNeedsDisplay ();
Driver.SetAttribute (ColorScheme.Normal);
Driver.DrawFrame (scrRect, padding, false);
diff --git a/Terminal.Gui/Views/HexView.cs b/Terminal.Gui/Views/HexView.cs
index ada9544b1..fff143233 100644
--- a/Terminal.Gui/Views/HexView.cs
+++ b/Terminal.Gui/Views/HexView.cs
@@ -130,7 +130,7 @@ namespace Terminal.Gui {
}
///
- public override void Redraw (Rect region)
+ public override void Redraw (Rect bounds)
{
Attribute currentAttribute;
var current = ColorScheme.Focus;
@@ -149,7 +149,7 @@ namespace Terminal.Gui {
for (int line = 0; line < frame.Height; line++) {
var lineRect = new Rect (0, line, frame.Width, 1);
- if (!region.Contains (lineRect))
+ if (!bounds.Contains (lineRect))
continue;
Move (0, line);
diff --git a/Terminal.Gui/Views/Label.cs b/Terminal.Gui/Views/Label.cs
index b1d2a575a..361d66d8f 100644
--- a/Terminal.Gui/Views/Label.cs
+++ b/Terminal.Gui/Views/Label.cs
@@ -161,7 +161,7 @@ namespace Terminal.Gui {
}
///
- public override void Redraw (Rect region)
+ public override void Redraw (Rect bounds)
{
if (recalcPending)
Recalc ();
@@ -173,7 +173,7 @@ namespace Terminal.Gui {
Clear ();
for (int line = 0; line < lines.Count; line++) {
- if (line < region.Top || line > region.Bottom)
+ if (line < bounds.Top || line > bounds.Bottom)
continue;
var str = lines [line];
int x;
diff --git a/Terminal.Gui/Views/ListView.cs b/Terminal.Gui/Views/ListView.cs
index c325485cb..44ec32f20 100644
--- a/Terminal.Gui/Views/ListView.cs
+++ b/Terminal.Gui/Views/ListView.cs
@@ -272,7 +272,7 @@ namespace Terminal.Gui {
}
///
- public override void Redraw (Rect region)
+ public override void Redraw (Rect bounds)
{
var current = ColorScheme.Focus;
Driver.SetAttribute (current);
diff --git a/Terminal.Gui/Views/Menu.cs b/Terminal.Gui/Views/Menu.cs
index 5f25cb797..5c5de6c8f 100644
--- a/Terminal.Gui/Views/Menu.cs
+++ b/Terminal.Gui/Views/Menu.cs
@@ -276,10 +276,10 @@ namespace Terminal.Gui {
return ColorScheme.Normal;
}
- public override void Redraw (Rect region)
+ public override void Redraw (Rect bounds)
{
Driver.SetAttribute (ColorScheme.Normal);
- DrawFrame (region, padding: 0, fill: true);
+ DrawFrame (bounds, padding: 0, fill: true);
for (int i = 0; i < barItems.Children.Length; i++) {
var item = barItems.Children [i];
@@ -624,7 +624,7 @@ namespace Terminal.Gui {
}
///
- public override void Redraw (Rect region)
+ public override void Redraw (Rect bounds)
{
Move (0, 0);
Driver.SetAttribute (Colors.Menu.Normal);
diff --git a/Terminal.Gui/Views/RadioGroup.cs b/Terminal.Gui/Views/RadioGroup.cs
index c86ea2259..d3cf2e659 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)
+ public override void Redraw (Rect bounds)
{
for (int i = 0; i < radioLabels.Length; i++) {
Move (0, i);
@@ -116,7 +116,7 @@ namespace Terminal.Gui {
Driver.AddStr (i == selected ? "(o) " : "( ) ");
DrawHotString (radioLabels [i], HasFocus && i == cursor, ColorScheme);
}
- base.Redraw (region);
+ base.Redraw (bounds);
}
///
diff --git a/Terminal.Gui/Views/ScrollView.cs b/Terminal.Gui/Views/ScrollView.cs
index 12db88de7..e03dbdee0 100644
--- a/Terminal.Gui/Views/ScrollView.cs
+++ b/Terminal.Gui/Views/ScrollView.cs
@@ -397,19 +397,22 @@ namespace Terminal.Gui {
/// This event is raised when the contents have scrolled
///
//public event Action Scrolled;
-
public override void Redraw(Rect region)
{
SetViewsNeedsDisplay ();
Driver.SetAttribute (ColorScheme.Normal);
Clear ();
- //if (Driver.Clip.IsEmpty || Driver.Clip.Contains (RectToScreen (contentView.Frame))) {
+ var savedClip = ClipToBounds ();
+ contentView.Redraw (contentView.Bounds);
+ Driver.Clip = savedClip;
+
+ //if (Driver.Clip.IsEmpty || Driver.Clip.Contains (ViewToScreen (contentView.Frame))) {
// var savedClip = ClipToBounds ();
- // contentView.Redraw (contentView.Frame);
+ // contentView.Redraw (contentView.Bounds);
// Driver.Clip = savedClip;
//} else {
- contentView.Redraw (contentView.Bounds);
+ // contentView.Redraw (contentView.Bounds);
//}
vertical.Redraw (vertical.Bounds);
horizontal.Redraw (vertical.Bounds);
diff --git a/Terminal.Gui/Views/StatusBar.cs b/Terminal.Gui/Views/StatusBar.cs
index 05a1883a4..90015b491 100644
--- a/Terminal.Gui/Views/StatusBar.cs
+++ b/Terminal.Gui/Views/StatusBar.cs
@@ -151,7 +151,7 @@ namespace Terminal.Gui {
}
///
- public override void Redraw (Rect region)
+ public override void Redraw (Rect bounds)
{
//if (Frame.Y != Driver.Rows - 1) {
// Frame = new Rect (Frame.X, Driver.Rows - 1, Frame.Width, Frame.Height);
diff --git a/Terminal.Gui/Views/TextField.cs b/Terminal.Gui/Views/TextField.cs
index 79e3b2400..afd94d408 100644
--- a/Terminal.Gui/Views/TextField.cs
+++ b/Terminal.Gui/Views/TextField.cs
@@ -184,7 +184,7 @@ namespace Terminal.Gui {
}
///
- public override void Redraw (Rect region)
+ public override void Redraw (Rect bounds)
{
ColorScheme color = Colors.Menu;
SetSelectedStartSelectedLength ();
diff --git a/Terminal.Gui/Views/TextView.cs b/Terminal.Gui/Views/TextView.cs
index 6c5baedac..a6d782fe4 100644
--- a/Terminal.Gui/Views/TextView.cs
+++ b/Terminal.Gui/Views/TextView.cs
@@ -525,31 +525,31 @@ namespace Terminal.Gui {
}
///
- public override void Redraw (Rect region)
+ public override void Redraw (Rect bounds)
{
ColorNormal ();
- int bottom = region.Bottom;
- int right = region.Right;
- for (int row = region.Top; row < bottom; row++)
+ int bottom = bounds.Bottom;
+ int right = bounds.Right;
+ for (int row = bounds.Top; row < bottom; row++)
{
int textLine = topRow + row;
if (textLine >= model.Count)
{
ColorNormal ();
- ClearRegion (region.Left, row, region.Right, row + 1);
+ ClearRegion (bounds.Left, row, bounds.Right, row + 1);
continue;
}
var line = model.GetLine (textLine);
int lineRuneCount = line.Count;
- if (line.Count < region.Left)
+ if (line.Count < bounds.Left)
{
- ClearRegion (region.Left, row, region.Right, row + 1);
+ ClearRegion (bounds.Left, row, bounds.Right, row + 1);
continue;
}
- Move (region.Left, row);
- for (int col = region.Left; col < right; col++)
+ Move (bounds.Left, row);
+ for (int col = bounds.Left; col < right; col++)
{
var lineCol = leftColumn + col;
var rune = lineCol >= lineRuneCount ? ' ' : line [lineCol];
diff --git a/Terminal.Gui/Windows/FileDialog.cs b/Terminal.Gui/Windows/FileDialog.cs
index 89c02b8ee..48451f045 100644
--- a/Terminal.Gui/Windows/FileDialog.cs
+++ b/Terminal.Gui/Windows/FileDialog.cs
@@ -159,7 +159,7 @@ namespace Terminal.Gui {
Move (allowsMultipleSelection ? 3 : 2, line);
int byteLen = ustr.Length;
- int used = 0;
+ int used = allowsMultipleSelection ? 2 : 1;
for (int i = 0; i < byteLen;) {
(var rune, var size) = Utf8.DecodeRune (ustr, i, i - byteLen);
var count = Rune.ColumnWidth (rune);
@@ -169,12 +169,12 @@ namespace Terminal.Gui {
used += count;
i += size;
}
- for (; used < width; used++) {
+ for (; used < width - 1; used++) {
Driver.AddRune (' ');
}
}
- public override void Redraw (Rect region)
+ public override void Redraw (Rect bounds)
{
var current = ColorScheme.Focus;
Driver.SetAttribute (current);
@@ -182,7 +182,7 @@ namespace Terminal.Gui {
var f = Frame;
var item = top;
bool focused = HasFocus;
- var width = region.Width;
+ var width = bounds.Width;
for (int row = 0; row < f.Height; row++, item++) {
bool isSelected = item == selected;
@@ -463,7 +463,7 @@ namespace Terminal.Gui {
dirListView = new DirListView (this) {
X = 1,
Y = 3 + msgLines + 2,
- Width = Dim.Fill () - 3,
+ Width = Dim.Fill () - 1,
Height = Dim.Fill () - 2,
};
DirectoryPath = Path.GetFullPath (Environment.CurrentDirectory);
@@ -488,6 +488,9 @@ namespace Terminal.Gui {
};
AddButton (this.prompt);
+ Width = Dim.Percent (80);
+ Height = Dim.Percent (80);
+
// On success, we will set this to false.
canceled = true;
}
diff --git a/UICatalog/Scenarios/Clipping.cs b/UICatalog/Scenarios/Clipping.cs
index f0fde5f91..80856b443 100644
--- a/UICatalog/Scenarios/Clipping.cs
+++ b/UICatalog/Scenarios/Clipping.cs
@@ -32,42 +32,70 @@ namespace UICatalog {
//Win.Y = 2;
//Win.Width = Dim.Fill () - 4;
//Win.Height = Dim.Fill () - 2;
- var label = new Label ("ScrollView (new Rect (2, 2, 50, 20)) with a 200, 100 ContentSize...") {
+ var label = new Label ("ScrollView (new Rect (5, 5, 100, 60)) with a 200, 100 ContentSize...") {
X = 0, Y = 0,
ColorScheme = Colors.Dialog
};
Top.Add (label);
- var scrollView = new ScrollView (new Rect (2, 2, 50, 20));
- scrollView.ColorScheme = Colors.TopLevel;
- scrollView.ContentSize = new Size (200, 100);
+ var scrollView = new ScrollView (new Rect (3, 3, 50, 20));
+ scrollView.ColorScheme = Colors.Menu;
+ scrollView.ContentSize = new Size (100, 60);
//ContentOffset = new Point (0, 0),
scrollView.ShowVerticalScrollIndicator = true;
scrollView.ShowHorizontalScrollIndicator = true;
- const string rule = "|123456789";
- var horizontalRuler = new Label ("") {
- X = 0,
- Y = 0,
- Width = Dim.Fill (1), // BUGBUG: I don't think this should be needed; DimFill() should respect container's frame. X does.
+ //const string rule = "|123456789";
+ //var horizontalRuler = new Label ("") {
+ // X = 0,
+ // Y = 0,
+ // Width = Dim.Fill (1), // BUGBUG: I don't think this should be needed; DimFill() should respect container's frame. X does.
+ // ColorScheme = Colors.Error
+ //};
+ //scrollView.Add (horizontalRuler);
+ //const string vrule = "|\n1\n2\n3\n4\n5\n6\n7\n8\n9\n";
+
+ //var verticalRuler = new Label ("") {
+ // X = 0,
+ // Y = 0,
+ // Width = 1,
+ // Height = Dim.Fill (),
+ // ColorScheme = Colors.Error
+ //};
+ //scrollView.Add (verticalRuler);
+
+ //Application.Resized += (sender, a) => {
+ // horizontalRuler.Text = rule.Repeat ((int)Math.Ceiling ((double)(horizontalRuler.Bounds.Width) / (double)rule.Length)) [0..(horizontalRuler.Bounds.Width)];
+ // verticalRuler.Text = vrule.Repeat ((int)Math.Ceiling ((double)(verticalRuler.Bounds.Height * 2) / (double)rule.Length)) [0..(verticalRuler.Bounds.Height * 2)];
+ //};
+
+ var embedded1 = new Window ("1") {
+ X = 3,
+ Y = 3,
+ Width = Dim.Fill (3),
+ Height = Dim.Fill (3),
+ ColorScheme = Colors.Dialog
+ };
+
+ var embedded2 = new Window ("2") {
+ X = 3,
+ Y = 3,
+ Width = Dim.Fill (3),
+ Height = Dim.Fill (3),
ColorScheme = Colors.Error
};
- scrollView.Add (horizontalRuler);
- const string vrule = "|\n1\n2\n3\n4\n5\n6\n7\n8\n9\n";
+ embedded1.Add (embedded2);
- var verticalRuler = new Label ("") {
- X = 0,
- Y = 0,
- Width = 1,
- Height = Dim.Fill (),
- ColorScheme = Colors.Error
+ var embedded3 = new Window ("3") {
+ X = 3,
+ Y = 3,
+ Width = Dim.Fill (3),
+ Height = Dim.Fill (3),
+ ColorScheme = Colors.TopLevel
};
- scrollView.Add (verticalRuler);
+ embedded2.Add (embedded3);
- Application.Resized += (sender, a) => {
- horizontalRuler.Text = rule.Repeat ((int)Math.Ceiling ((double)(horizontalRuler.Bounds.Width) / (double)rule.Length)) [0..(horizontalRuler.Bounds.Width)];
- verticalRuler.Text = vrule.Repeat ((int)Math.Ceiling ((double)(verticalRuler.Bounds.Height * 2) / (double)rule.Length)) [0..(verticalRuler.Bounds.Height * 2)];
- };
+ scrollView.Add (embedded1);
//scrollView.Add (new Button ("Press me!") {
// X = 3,
diff --git a/UICatalog/Scenarios/Scrolling.cs b/UICatalog/Scenarios/Scrolling.cs
index 78e554d0e..1526047bb 100644
--- a/UICatalog/Scenarios/Scrolling.cs
+++ b/UICatalog/Scenarios/Scrolling.cs
@@ -9,10 +9,10 @@ namespace UICatalog {
class Scrolling : Scenario {
public override void Setup ()
{
- Win.X = 1;
- Win.Y = 2;
- Win.Width = Dim.Fill () - 4;
- Win.Height = Dim.Fill () - 2;
+ Win.X = 3;
+ Win.Y = 3;
+ Win.Width = Dim.Fill () - 3;
+ Win.Height = Dim.Fill () - 3;
var label = new Label ("ScrollView (new Rect (2, 2, 50, 20)) with a 200, 100 ContentSize...") {
X = 0, Y = 0,
ColorScheme = Colors.Dialog
@@ -60,7 +60,7 @@ namespace UICatalog {
scrollView.Add (new Button ("A very long button. Should be wide enough to demo clipping!") {
X = 3,
Y = 4,
- Width = 50,
+ Width = Dim.Fill(6),
Clicked = () => MessageBox.Query (20, 7, "MessageBox", "Neat?", "Yes", "No")
});