Skip to content
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

Wizards background shifts to gray when focusing, looks bad. #2571

Closed
krypto5863 opened this issue Apr 22, 2023 · 14 comments · Fixed by #2706 or #3194
Closed

Wizards background shifts to gray when focusing, looks bad. #2571

krypto5863 opened this issue Apr 22, 2023 · 14 comments · Fixed by #2706 or #3194
Labels

Comments

@krypto5863
Copy link

Describe the bug
Focusing on a wizard window tends to make the background gray which tends to mess up the look.

To Reproduce
Open a wizard and click the view. It's most noticeable with textboxes an stuff.

Expected behavior
I expected the clicked element, buttons/textboxes/etc,. to change color to show they're focused, instead the whole window went gray.

Screenshots
image

@BDisp
Copy link
Collaborator

BDisp commented Apr 22, 2023

That isn't happening with me on both v1 and v2.

imagem

@krypto5863
Copy link
Author

krypto5863 commented Apr 22, 2023

That's strange, I'm just running UI catalog, haven't touched anything in the project either, happens with my own separate project where I get Terminal.GUI via nuget also.

@BDisp
Copy link
Collaborator

BDisp commented Apr 22, 2023

Maybe the nuget package isn't yet updated with the current develop branch.

@krypto5863
Copy link
Author

Nuget version reads 1.10.1, but I cloned the repo to run the UICatalog, so it shouldn't matter anyways.

@tig tig added the bug label Apr 28, 2023
@WayneHiller
Copy link

I am having the same issue.

image

@tznind
Copy link
Collaborator

tznind commented May 2, 2023

Here is a minimum repro

wizard

Its probably not much consolation but this does seem to be fixed in v2_develop

using Terminal.Gui;

Application.Init();

var w = new Window();

var label = new Label("I'm outside wizard:");
var tf = new TextField("yay") { X = 20, Width = 20 };
w.Add(label);
w.Add(tf);

var wizard = new Wizard
{
    X = 0,
    Y = 1,
    Width = Dim.Fill(),
    Height = Dim.Fill(),
    Modal = false,
    TabStop = true
};

var step = new Wizard.WizardStep("Yarg");
step.Add(new Label("SomeText:"));
step.Add(new TextField() { Y=1,Width = 10});
step.Add(new Label("SomeText2:") { Y = 2, });
step.Add(new TextField() { Y = 3, Width = 10 });

wizard.AddStep(step);


var step2 = new Wizard.WizardStep("Blerg");
step2.Add(new Label("SomeText3:"));
step2.Add(new TextField() { Y = 1, Width = 10 });
wizard.AddStep(step2);

w.Add(wizard);

Application.Run(w);

Application.Shutdown();

@Pieshka
Copy link

Pieshka commented Jun 8, 2023

It's happening in my project too. The example above also produces identical effect. I found out, that this started to happen after this commit. When rolled back to previous commit, background is not shifting to gray anymore. That problem also occures on version 1.12.1 and latest develop commit, so it's not fixed yet.

@tig
Copy link
Collaborator

tig commented Jun 8, 2023

I'll look into this asap!

@Pieshka
Copy link

Pieshka commented Jun 9, 2023

It turns out that the problem does not only occur with Wizard, but also with TabView. You can see this using the code below, but the TabView Demo from UICatalog (tab "Interactive Tab") also has this bug.

Application.Init();
Toplevel top = Application.Top;
Window mainWindow = new Window("MainWindow");

View tabTestView = new View() { Height = Dim.Fill(), Width = Dim.Fill() };
tabTestView.Add(new Label("SomeText:") { Y = 0 });
tabTestView.Add(new TextField() { Y = 1, Width = 10 });
tabTestView.Add(new Label("SomeText2:") { Y = 2 });
tabTestView.Add(new TextField() { Y = 3, Width = 10 });

TabView tabs = new TabView() 
{ 
    Width = Dim.Fill(),
    Height = Dim.Fill()
};
tabs.AddTab(new TabView.Tab("Tab1", tabTestView),false);
mainWindow.Add(tabs);
top.Add(mainWindow);
Application.Run();
Application.Shutdown();

tabview_bug
tabview_bug_uicatalog

@BDisp
Copy link
Collaborator

BDisp commented Jun 9, 2023

The fix was done @Piotr86PL in f019826.
In the v1 if we don't want a View to being clear we must initialize it through a View derived private class.

@tig tig closed this as completed in #2706 Jul 5, 2023
tig pushed a commit that referenced this issue Jul 5, 2023
…ad. (#2706)

* Fixes #2571. Wizards background shifts to gray when focusing, looks bad.

* Fix margin being negative on Pos.AnchorEnd.

* Fix background color in tab views.

* All tabs need to be manually disposed.
@heinrich-ulbricht
Copy link

heinrich-ulbricht commented Dec 13, 2023

I also had this issue and have another one that in my view is related to the fix.

If have a dialog, containing a TabView.

There is text from the first tab showing up when switching to other tabs. Best to show it:

wikitraccs-settings-error

Like the content of the first tab still exists in the upper left corner of the main window (and only there - in my case you don't notice that when the dialog is centered, e.g. on a large screen).

@BDisp Can it be that this line...

contentView.Remove (selectedTab.View);

...is also needed after this:

foreach (var view in selectedTab.View.Subviews) {
contentView.Remove (view);
}

Same here:

contentView.Add (selectedTab.View);

It seems to solve the issue and the characters are gone.

heinrich-ulbricht added a commit to WikiTransformationProject/Terminal.Gui that referenced this issue Dec 13, 2023
@BDisp
Copy link
Collaborator

BDisp commented Dec 14, 2023

Can you reproduce this on the v2 too? Can you please write s small example that reproduce this for to more quicker find the cause? Thanks.

@BDisp BDisp reopened this Dec 14, 2023
@heinrich-ulbricht
Copy link

@BDisp Thanks for the reponse! I'm bound to v1. The UI is moderately complex, I need to strip it down. Hope to do that over the holidays.

@BDisp
Copy link
Collaborator

BDisp commented Jan 20, 2024

@BDisp Thanks for the reponse! I'm bound to v1. The UI is moderately complex, I need to strip it down. Hope to do that over the holidays.

@heinrich-ulbricht can you please test with the PR #3194 to confirm if it's working well now for you. Thanks.

@tig tig closed this as completed in #3194 Jan 20, 2024
tig pushed a commit that referenced this issue Jan 20, 2024
…ad. (#3194)

* Fixes #2571. Wizards background shifts to gray when focusing, looks bad.

* Update nuget packages.

* Trying to fix the CodeQL failing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
7 participants