-
Notifications
You must be signed in to change notification settings - Fork 703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ListView does not render correctly before focus #2705
Comments
Since you are using |
To be precise, I actually write my application as in the code below, i.e. each custom window is a separate class, and in the MenuBar I create new instances of windows, rather than using the already instantiated ones. I rewrote my test code just like this and the problem still occurs - now it's even every time I change windows you can see the unrendered part of the list. After adding Dispose, nothing improved either. In version 1.9.0 this problem does not occur, even without Dispose. public class SecondWindow : Window
{
public SecondWindow(string title) : base(title)
{
InitializeControls();
}
private void InitializeControls()
{
List<string> list = new List<string>();
for (int i = 0; i < 100; i++)
{
list.Add("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec non velit dignissim, mollis sem id, aliquet nisl.");
}
ListView newLV = new ListView(list)
{
X = 2,
Y = 2,
Height = Dim.Fill(3),
Width = Dim.Fill(3),
ColorScheme = Colors.Dialog,
AllowsMarking = false,
AllowsMultipleSelection = false,
TextAlignment = TextAlignment.Justified
};
Button refreshB = new Button("Refresh") { X = 2, Y = Pos.Bottom(this) - 5, Enabled = true };
Button addNewB = new Button("Add New") { X = Pos.Right(refreshB) + 1, Y = Pos.Bottom(this) - 5, Enabled = true };
Button deleteB = new Button("Delete") { X = Pos.Right(addNewB) + 1, Y = Pos.Bottom(this) - 5, Enabled = true };
Add(newLV, refreshB, addNewB, deleteB);
}
}
public class Program
{
static void Main(string[] args)
{
Application.Init();
Toplevel topLvl = Application.Top;
Window topWindow = new Window("Top Window");
MenuBar toolBar = new MenuBar(
new MenuBarItem[] {
new MenuBarItem("Window Switcher", new MenuItem[]
{
new MenuItem("First Window","",()=>{
foreach (View child in topWindow.Subviews)
child.Dispose();
topWindow.RemoveAll();
topWindow.Add(new Window("First Window"));
}),
new MenuItem("Second Window","",()=>{
foreach (View child in topWindow.Subviews)
child.Dispose();
topWindow.RemoveAll();
topWindow.Add(new SecondWindow("Second Window"));
})
})
});
topLvl.Add(toolBar);
topLvl.Add(topWindow);
Application.Run();
Application.Shutdown();
}
} |
Describe the bug
When I switch from one window, to another that has not yet been displayed, the ListView is rendered incorrectly. The moment I focus on the window, everything gets fixed. I have noticed that the problem is present as of this commit and has not been fixed in either v1.12.1 or the develop branch.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
ListView will render correctly without having to focus the window.
Screenshots
Additional context
The code I used:
The text was updated successfully, but these errors were encountered: