Repository: gui-cs/Terminal.Gui

Issue #124: Add multi-step Wizard view
Created: 2018-09-12T10:34:31Z
Hi,
This is an awesome library. I like it very much. I am trying to create an application based on form wizard for initial setup but in Linux. Regarding that I have few questions.
I am thinking of adding a window as container in the Application.Top. This container will load the View dynamically. I am also adding two buttons Next and Previous in the Top outside container.
Here are my questions:

My first form has really long text that I need to display along with scroll bar and radio button. Which view should I choose? ScrollView, ScrollBarView, TextView?
Can the TextView be rendered with readonly attribute?
Previous and Next button are rendered outside of Top frame. Since those are going to remain static, how do I render them inside Top but outside container?



tab key navigates between only views inside container. i.e. in the above image, tab will switch focus between textview and radio button. Control doesn't focus on either Previous or Next buttons at all.
Window.removeAll() doesn't seem to remove the views immediately. I have to focus somewhere manually. Since I would like to keep one container for various forms, how do I solve this?

Here is my code:
Program.cs
using System.Threading.Tasks;
using Terminal.Gui;

namespace hive_appliance_console
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Application.Init();
            var top = Application.Top;

            //Create top level window to show
            var _formContainer = new Window("Hive Appliance Console")
            {
                X = 0,
                Y = 1,
                // Width = top.Frame.Width, 
                // Height = top.Frame.Height - 1
                Width = Dim.Fill(),
                Height = Dim.Fill() - 1
            };

            var menu = new MenuBar(new MenuBarItem [] 
            {
                new MenuBarItem("_Menu", new MenuItem [] 
                {
                    new MenuItem ("_Quit", "", () => 
                    { 
                        if (Quit ()) 
                        {
                            Application.RequestStop(); 
                        }
                    })
                })
            });

            var _eula = new Eula();
            _eula.LoadView(_formContainer);

            var _btnNext = new Button("Next") 
            { 
                X = Pos.Center() + 4,
                Y = Pos.Bottom(_formContainer),
                // Clicked = () => {
                //     _formContainer.RemoveAll();
                // }
            };
            var _btnPrevious = new Button("Previous") { X = Pos.Center() - 10, Y = Pos.Bottom(_formContainer)};

            top.Add(
                menu,
                _formContainer,
                _btnPrevious,
                _btnNext
            );
            Application.Run();
        }

        static bool Quit ()
        {
            var n = MessageBox.Query (50, 7, "Quit setup", "Are you sure you want to quit setup process?", "Yes", "No");
            return n.Equals(0);
        }
    }
}

and Eula.cs
using System;
using System.Collections.Generic;
using Terminal.Gui;

namespace hive_appliance_console
{
  public class Eula
  {
    private string _eulaFilePath = @"/home/pratik/hive/code/hive-appliance-console/eula.txt";

    public void LoadView(View container)
    {
        var _window = new Window("EULA");
        var _textView = new TextView()
        {
            X = 2,
            Y = 1,
            Width = Dim.Fill(),
            Height = Dim.Fill() - 2
        };
        _textView.LoadFile(_eulaFilePath);
        _window.Add(_textView);
        
        var _consent = new RadioGroup(new [] {"I accept", "I decline"}, 0)
        {
            X = Pos.Center(),
            Y = Pos.Bottom(_textView)
        };
        _window.Add(_consent);
        container.Add(_window);
    }
  }
}

Since you are in the process of creating document, I am asking this long question here. I feel like once this is resolved, I can work on my own.

Duplicate issue #469: UI Catalog: Multi-stage wizard
Created: 2020-05-21T02:10:24Z
Add a scenario to UI Catalog that demonstrates a multi-stage wizard.

Closing comment (2022-06-08T22:43:49Z): Dupe of #124