-
Notifications
You must be signed in to change notification settings - Fork 36
Closed
Description
To use ScrollView you must set ContentSize. Editor support will require:
- A designer for
Sizestruct - A sensible default in
ViewFactory - Possibly some drag and drop adjustment so that when dropping controls into the
ScrollViewwhen it is scrolled down works. - Code generation for
Size(ContentSize) - All the tests
- A way to drag and resize the view when it doesn't have any borders (already solved in Support for selecting and resizing 'View' basic class #106)
Here is the minimum code to produce a ScrollView. Setting ContentSize is absolutely vital. Without it stuff just doesn't work properly.
using Terminal.Gui;
Application.Init();
var win = new Window("Example App (Ctrl+Q to quit)");
var scr = new ScrollView()
{
Width = Dim.Fill(),
Height = Dim.Fill(),
ShowVerticalScrollIndicator = true
};
scr.ContentSize = new Size(30, 500);
scr.Add(new BigView());
win.Add(scr);
Application.Run(win);
Application.Shutdown();
class BigView : View
{
public BigView()
{
Height = 500;
Width = 30;
}
public override void Redraw(Rect bounds)
{
base.Redraw(bounds);
for(int x=0;x<30;x++)
{
for (int y = 0; y < 500; y++)
{
var digit = y % 10;
AddRune(x, y, digit.ToString()[0]);
}
}
}
}Metadata
Metadata
Assignees
Labels
No labels