Terminal.Gui: Running Wizard as a non-modal/non-popup is broken
Hi,
Following structure of UICatalog, I am trying to run Wizard scenario. The difference is that instead of calling Application.Run on Wizard as done here, I am simply adding it inside the MainWindow which is included in the Top. In this case, when the wizard shows the last step added as first step and then behaves completely in incorrect way. But if I call Application.Run(wizard) it works properly though it doesn’t show any other controls, like menu, that I have added in Top.
I have updated my sample app TerrminalWizard
What am I missing?
https://user-images.githubusercontent.com/5595263/177230377-9a6a4530-2a7d-4d7d-b6d5-52c725435770.mov
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 32 (13 by maintainers)
Commits related to this issue
- Fixes #1849. Wizard as non-popup is broken (#1853) * trying to make it work * Fixes #1849. Wizard as non-modal doesn't work * Fixes #1855. Window and Frame content view without the margin frame... — committed to gui-cs/Terminal.Gui by tig 2 years ago
- Fixes #1849. Wizard as non-popup is broken (#1853) * trying to make it work * Fixes #1849. Wizard as non-modal doesn't work * Fixes #1855. Window and Frame content view without the margin frame... — committed to BDisp/Terminal.Gui by tig 2 years ago
- Fixes #1861. Border: Title property is preferable to Text. (#1862) * Fixes #1861. Border Title property is preferable than the Text. * Fixes #1866. Bug when scrolling text and type in a TextView. ... — committed to gui-cs/Terminal.Gui by BDisp 2 years ago
How’s this look?
Note, I’m still playing with some layout and color things. Prepping a PR now.
@GaikwadPratik - In my fix for #1883 I have decided to make it so setting the first step explicitly is not needed IN YOUR CASE.
There is still a case where devs will need to do it, but it’s an outlier. The docs will now read:
Nope. Unrelated. I just did that because you already had a class and it was convenient vs having an ‘Wizard’ member variable.
-cek Sent via mobile. Expect brevity, typos, and dangerous driving.
From: Gaikwad Pratik @.> Sent: Saturday, July 23, 2022 7:22:46 AM To: migueldeicaza/gui.cs @.> Cc: Charlie Kindel @.) @.>; Mention @.***> Subject: Re: [migueldeicaza/gui.cs] Running Wizard as a non-modal/non-popup is broken (Issue #1849)
I’d just use .Visible
Okay. That makes sense. One last question for the day, In your PR to TerrminalWizard, you have inherited FirstBootWizard from Wizard because of #1883https://github.com/migueldeicaza/gui.cs/issues/1883. Once #1883https://github.com/migueldeicaza/gui.cs/issues/1883 is resolved, the inheritance becomes unnecessary correct?
— Reply to this email directly, view it on GitHubhttps://github.com/migueldeicaza/gui.cs/issues/1849#issuecomment-1193125131, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEO6CSZXQFMBOQGKTHQCODVVPW2NANCNFSM52URIXFQ. You are receiving this because you were mentioned.Message ID: @.***>
Nope. It doesn’t get called either for non-Modals. I’m going to submit an issue on this.
I found your issue. When using Wizard as a non-modal, you must explicitly set the first step. This is because when running as a modal, the
Loadedevent is fired, and I can set the first step there, but when non-modals don’t get aLoadedevent.I should have noted this in the API documentation for Wizard; I will submit a PR to do this asap.
I’ve submitted a PR to your project with this fix and with some re-factoring to simplify your code. I also couldn’t resist cleaning some other stuff up…hope you don’t mind!
Typically you want to avoid manually setting
ColorSchemeon an object unless you are actually trying to achieve a color change. The default behaviour of a view is to inherit from it’s parent.So if you have a
Window(defaults toColor.Base- blue background) and add a non modal View (button, label, wizard etc). Then the view will automatically take its parent color scheme.If you have a
Dialog(defaults toColor.Dialog- greyish background) and add a non modal view (button, label, wizard etc) then the view will take the parent scheme again and have a grey colored background (same as parent).If you have
ColorSchemeexplicitly set and you want to revert that on an instance and restore the ‘inheriting’ behaviour you can setmyView.ColorScheme = nullTop also has its own color scheme which is black background and adding controls that inherit ColorScheme from parent to that often looks wierd.
I’ve recently been diving pretty deep into the ColorScheme system in designer (see https://github.com/tznind/TerminalGuiDesigner/pull/33) so might be able to help with any color related issues your having.
Thank you for clarification. Just waiting for PR to be merged and having more fun developing the app.