mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Fixes Wizard cancel logic and updates docs (#1878)
* Fixed cancel logic. Title now shows for non-modal. * trying to fix docs * trying to fix docs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# Conceptual Documentation
|
||||
|
||||
* [Terminal.Gui Overview](overview.md)
|
||||
* [List of Views](views.md)
|
||||
* [Keyboard Event Processing](keyboard.md)
|
||||
* [Event Processing and the Application Main Loop](mainloop.md)
|
||||
* [TableView Deep Dive](tableview.md)
|
||||
|
||||
@@ -2,7 +2,7 @@ Keyboard Event Processing
|
||||
=========================
|
||||
|
||||
Keyboard events are sent by the [Main Loop](mainloop.md) to the
|
||||
Application class for processing. The keyboard events are sent
|
||||
Application class for processing. The keyboard events are sent
|
||||
exclusively to the current `Toplevel`, this being either the default
|
||||
that is created when you call `Application.Init`, or one that you
|
||||
created an passed to `Application.Run(Toplevel)`.
|
||||
@@ -19,10 +19,10 @@ HotKey Processing
|
||||
|
||||
Events are first send to all views as a "HotKey", this means that the
|
||||
`View.ProcessHotKey` method is invoked on the current toplevel, which
|
||||
in turns propagates this to all the views in the hierarchy. If any
|
||||
in turns propagates this to all the views in the hierarchy. If any
|
||||
view decides to process the event, no further processing takes place.
|
||||
|
||||
This is how hotkeys for buttons are implemented. For example, the
|
||||
This is how hotkeys for buttons are implemented. For example, the
|
||||
keystroke "Alt-A" is handled by Buttons that have a hot-letter "A" to
|
||||
activate the button.
|
||||
|
||||
@@ -42,7 +42,7 @@ event, and is broadcast to all the views in the Toplevel.
|
||||
|
||||
This method can be overwritten by views that want to provide
|
||||
accelerator functionality (Alt-key for example), but without
|
||||
interefering with normal ProcessKey behavior.
|
||||
interfering with normal ProcessKey behavior.
|
||||
|
||||
Key Bindings
|
||||
-------------------
|
||||
@@ -70,5 +70,5 @@ in `RadioGroup`.
|
||||
Global Key Handler
|
||||
--------------------
|
||||
Sometimes you may want to define global key handling logic for your entire
|
||||
application that is invoked regardless of what Window/View has focus. This can
|
||||
application that is invoked regardless of what Window/View has focus. This can
|
||||
be achieved by using the `Application.RootKeyEvent` event.
|
||||
|
||||
@@ -32,7 +32,7 @@ When your code invokes `Application.Run (Toplevel)`, the application
|
||||
will prepare the current
|
||||
[`Toplevel`](~/api/Terminal.Gui/Terminal.Gui.Toplevel.yml) instance by
|
||||
redrawing the screen appropriately and then calling the mainloop to
|
||||
run.
|
||||
run.
|
||||
|
||||
You can configure the Mainloop before calling Application.Run, or you
|
||||
can configure the MainLoop in response to events during the execution.
|
||||
@@ -83,8 +83,8 @@ Idle Handlers
|
||||
You can register code to be executed when the application is idling
|
||||
and there are no events to process by calling the
|
||||
[`AddIdle`]()
|
||||
method. This method takes as a parameter a function that will be
|
||||
invoked when the application is idling.
|
||||
method. This method takes as a parameter a function that will be
|
||||
invoked when the application is idling.
|
||||
|
||||
Idle functions should return `true` if they should be invoked again,
|
||||
and `false` if the idle invocations should stop.
|
||||
@@ -98,18 +98,18 @@ Threading
|
||||
Like other UI toolkits, Terminal.Gui is generally not thread safe.
|
||||
You should avoid calling methods in the UI classes from a background
|
||||
thread as there is no guarantee that they will not corrupt the state
|
||||
of the UI application.
|
||||
of the UI application.
|
||||
|
||||
Generally, as there is not much state, you will get lucky, but the
|
||||
application will not behave properly.
|
||||
|
||||
You will be served better off by using C# async machinery and the
|
||||
various APIs in the `System.Threading.Tasks.Task` APIs. But if you
|
||||
various APIs in the `System.Threading.Tasks.Task` APIs. But if you
|
||||
absolutely must work with threads on your own you should only invoke
|
||||
APIs in Terminal.Gui from the main thread.
|
||||
|
||||
To make this simple, you can use the `Application.MainLoop.Invoke`
|
||||
method and pass an `Action`. This action will be queued for execution
|
||||
method and pass an `Action`. This action will be queued for execution
|
||||
on the main thread at an appropriate time and will run your code
|
||||
there.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ well as modern color terminals with mouse support.
|
||||
This library works across Windows, Linux and MacOS.
|
||||
|
||||
This library provides a text-based toolkit as works in a way similar
|
||||
to graphic toolkits. There are many controls that can be used to
|
||||
to graphic toolkits. There are many controls that can be used to
|
||||
create your applications and it is event based, meaning that you
|
||||
create the user interface, hook up various events and then let the
|
||||
a processing loop run your application, and your code is invoked via
|
||||
@@ -38,7 +38,7 @@ which value was selected by the user (Yes, No, or if they use chose
|
||||
not to make a decision and instead pressed the ESC key).
|
||||
|
||||
More interesting user interfaces can be created by composing some of
|
||||
the various views that are included. In the following sections, you
|
||||
the various views that are included. In the following sections, you
|
||||
will see how applications are put together.
|
||||
|
||||
In the example above, you can see that we have initialized the runtime by calling the
|
||||
@@ -106,12 +106,12 @@ Views
|
||||
=====
|
||||
|
||||
All visible elements on a Terminal.Gui application are implemented as
|
||||
[Views](~/api/Terminal.Gui/Terminal.Gui.View.yml). Views are self-contained
|
||||
[Views](~/api/Terminal.Gui/Terminal.Gui.View.yml). Views are self-contained
|
||||
objects that take care of displaying themselves, can receive keyboard and mouse
|
||||
input and participate in the focus mechanism.
|
||||
|
||||
Every view can contain an arbitrary number of children views. These are called
|
||||
the Subviews. You can add a view to an existing view, by calling the
|
||||
Every view can contain an arbitrary number of children views. These are called
|
||||
the Subviews. You can add a view to an existing view, by calling the
|
||||
[`Add`](~/api/Terminal.Gui/Terminal.Gui.View.yml#Terminal_Gui_View_Add_Terminal_Gui_View_) method, for example, to add a couple of buttons to a UI, you can do this:
|
||||
|
||||
```csharp
|
||||
@@ -138,9 +138,35 @@ void SetupMyView (View myView)
|
||||
The container of a given view is called the `SuperView` and it is a property of every
|
||||
View.
|
||||
|
||||
There are many views that you can use to spice up your application:
|
||||
*Terminal.Gui* provides a rich set of views and controls for building terminal user interfaces:
|
||||
|
||||
[Buttons](~/api/Terminal.Gui/Terminal.Gui.Button.yml), [Labels](~/api/Terminal.Gui/Terminal.Gui.Label.yml), [Text entry](~/api/Terminal.Gui/Terminal.Gui.TextField.yml), [Text view](~/api/Terminal.Gui/Terminal.Gui.TextView.yml), [Radio buttons](~/api/Terminal.Gui/Terminal.Gui.RadioGroup.yml), [Checkboxes](~/api/Terminal.Gui/Terminal.Gui.CheckBox.yml), [Dialog boxes](~/api/Terminal.Gui/Terminal.Gui.Dialog.yml), [Message boxes](~/api/Terminal.Gui/Terminal.Gui.MessageBox.yml), [Windows](~/api/Terminal.Gui/Terminal.Gui.Window.yml), [Menus](~/api/Terminal.Gui/Terminal.Gui.MenuBar.yml), [ListViews](~/api/Terminal.Gui/Terminal.Gui.ListView.yml), [Frames](~/api/Terminal.Gui/Terminal.Gui.FrameView.yml), [ProgressBars](~/api/Terminal.Gui/Terminal.Gui.ProgressBar.yml), [Scroll views](~/api/Terminal.Gui/Terminal.Gui.ScrollView.yml) and [Scrollbars](~/api/Terminal.Gui/Terminal.Gui.ScrollBarView.yml).
|
||||
* [Button](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.Button.html)
|
||||
* [CheckBox](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.CheckBox.html)
|
||||
* [ColorPicker](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.ColorPicker.html)
|
||||
* [ComboBox](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.ComboBox.html)
|
||||
* [Dialog](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.Dialog.html)
|
||||
* [OpenDialog](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.OpenDialog.html)
|
||||
* [SaveDialog](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.SaveDialog.html)
|
||||
* [FrameView](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.FrameView.html)
|
||||
* [GraphView](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.GraphView.html)
|
||||
* [Hex viewer/editor](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.HexView.html)
|
||||
* [Label](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.Label.html)
|
||||
* [ListView](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.ListView.html)
|
||||
* [Menu](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.MenuBar.html)
|
||||
* [MessageBox](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.MessageBox.html)
|
||||
* [ProgressBar](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.ProgressBar.html)
|
||||
* [Radio buttons](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.RadioGroup.html)
|
||||
* [TableView](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.TableView.html)
|
||||
* [Time & Date Fields](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.TimeField.html)
|
||||
* [TextField](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.TextField.html)
|
||||
* [TextValidateField](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.TextValidateField.html)
|
||||
* [TextView (Text Editor)](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.TextView.html)
|
||||
* [TreeView](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.TreeView.html)
|
||||
* [ScrollView](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.ScrollView.html)
|
||||
* [ScrollBarView](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.ScrollBarView.html)
|
||||
* [StatusBar](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.StatusBar.html)
|
||||
* [Window](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.Window.html)
|
||||
* [Wizard](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.Wizard.html)
|
||||
|
||||
Layout
|
||||
------
|
||||
@@ -150,12 +176,12 @@ Layout
|
||||
property on the view.
|
||||
|
||||
The absolute system is used when you want the view to be positioned exactly in
|
||||
one location and want to manually control where the view is. This is done
|
||||
by invoking your View constructor with an argument of type [`Rect`](~/api/Terminal.Gui/Terminal.Gui.Rect.yml). When you do this, to change the
|
||||
one location and want to manually control where the view is. This is done
|
||||
by invoking your View constructor with an argument of type [`Rect`](~/api/Terminal.Gui/Terminal.Gui.Rect.yml). When you do this, to change the
|
||||
position of the View, you can change the `Frame` property on the View.
|
||||
|
||||
The computed layout system offers a few additional capabilities, like automatic
|
||||
centering, expanding of dimensions and a handful of other features. To use
|
||||
centering, expanding of dimensions and a handful of other features. To use
|
||||
this you construct your object without an initial `Frame`, but set the
|
||||
`X`, `Y`, `Width` and `Height` properties after the object has been created.
|
||||
|
||||
@@ -229,7 +255,7 @@ anotherView.Height = Dim.Height (view)+1
|
||||
Among the many kinds of views, you typically will create a [Toplevel](~/api/Terminal.Gui/Terminal.Gui.Toplevel.yml) view (or any of its subclasses,
|
||||
like [Window](~/api/Terminal.Gui/Terminal.Gui.Window.yml) or [Dialog](~/api/Terminal.Gui/Terminal.Gui.Dialog.yml) which is special kind of views
|
||||
that can be executed modally - that is, the view can take over all input and returns
|
||||
only when the user chooses to complete their work there.
|
||||
only when the user chooses to complete their work there.
|
||||
|
||||
The following sections cover the differences.
|
||||
|
||||
@@ -237,7 +263,7 @@ The following sections cover the differences.
|
||||
|
||||
[Toplevel](~/api/Terminal.Gui/Terminal.Gui.Toplevel.yml) views have no visible user interface elements and occupy an arbitrary portion of the screen.
|
||||
|
||||
You would use a toplevel Modal view for example to launch an entire new experience in your application, one where you would have a new top-level menu for example. You
|
||||
You would use a toplevel Modal view for example to launch an entire new experience in your application, one where you would have a new top-level menu for example. You
|
||||
typically would add a Menu and a Window to your Toplevel, it would look like this:
|
||||
|
||||
```csharp
|
||||
@@ -326,7 +352,7 @@ Running Modally
|
||||
---------------
|
||||
|
||||
To run your Dialog, Window or Toplevel modally, you will invoke the `Application.Run`
|
||||
method on the toplevel. It is up to your code and event handlers to invoke the `Application.RequestStop()` method to terminate the modal execution.
|
||||
method on the toplevel. It is up to your code and event handlers to invoke the `Application.RequestStop()` method to terminate the modal execution.
|
||||
|
||||
```csharp
|
||||
bool okpressed = false;
|
||||
@@ -358,17 +384,17 @@ Input Handling
|
||||
==============
|
||||
|
||||
Every view has a focused view, and if that view has nested views, one of those is
|
||||
the focused view. This is called the focus chain, and at any given time, only one
|
||||
View has the focus.
|
||||
the focused view. This is called the focus chain, and at any given time, only one
|
||||
View has the focus.
|
||||
|
||||
The library binds the key Tab to focus the next logical view,
|
||||
and the Shift-Tab combination to focus the previous logical view.
|
||||
and the Shift-Tab combination to focus the previous logical view.
|
||||
|
||||
Keyboard processing is divided in three stages: HotKey processing, regular processing and
|
||||
cold key processing.
|
||||
cold key processing.
|
||||
|
||||
* Hot key processing happens first, and it gives all the views in the current
|
||||
toplevel a chance to monitor whether the key needs to be treated specially. This
|
||||
toplevel a chance to monitor whether the key needs to be treated specially. This
|
||||
for example handles the scenarios where the user pressed Alt-o, and a view with a
|
||||
highlighted "o" is being displayed.
|
||||
|
||||
@@ -376,7 +402,7 @@ cold key processing.
|
||||
view.
|
||||
|
||||
* If the key was not processed by the normal processing, all views are given
|
||||
a chance to process the keystroke in their cold processing stage. Examples
|
||||
a chance to process the keystroke in their cold processing stage. Examples
|
||||
include the processing of the "return" key in a dialog when a button in the
|
||||
dialog has been flagged as the "default" action.
|
||||
|
||||
@@ -384,8 +410,8 @@ The most common case is the normal processing, which sends the keystrokes to the
|
||||
currently focused view.
|
||||
|
||||
Mouse events are processed in visual order, and the event will be sent to the
|
||||
view on the screen. The only exception is that no mouse events are delivered
|
||||
to background views when a modal view is running.
|
||||
view on the screen. The only exception is that no mouse events are delivered
|
||||
to background views when a modal view is running.
|
||||
|
||||
More details are available on the [`Keyboard Event Processing`](keyboard.md) document.
|
||||
|
||||
@@ -393,7 +419,7 @@ Colors and Color Schemes
|
||||
========================
|
||||
|
||||
All views have been configured with a color scheme that will work both in color
|
||||
terminals as well as the more limited black and white terminals.
|
||||
terminals as well as the more limited black and white terminals.
|
||||
|
||||
The various styles are captured in the [`Colors`](~/api/Terminal.Gui/Terminal.Gui.Colors.yml) class which defined color schemes for
|
||||
the toplevel, the normal views, the menu bar, popup dialog boxes and error dialog boxes, that you can use like this:
|
||||
|
||||
@@ -56,12 +56,12 @@ tableView.Table = yourDataTable;
|
||||
```
|
||||
|
||||
## Table Rendering
|
||||
TableView supports any size of table (limited only by the RAM requirements of `System.DataTable`). You can have
|
||||
thousands of columns and/or millions of rows if you want. Horizontal and vertical scrolling can be done using
|
||||
TableView supports any size of table (limited only by the RAM requirements of `System.DataTable`). You can have
|
||||
thousands of columns and/or millions of rows if you want. Horizontal and vertical scrolling can be done using
|
||||
the mouse or keyboard.
|
||||
|
||||
TableView uses `ColumnOffset` and `RowOffset` to determine the first visible cell of the `System.DataTable`.
|
||||
Rendering then continues until the avaialble console space is exhausted. Updating the `ColumnOffset` and
|
||||
Rendering then continues until the avaialble console space is exhausted. Updating the `ColumnOffset` and
|
||||
`RowOffset` changes which part of the table is rendered (scrolls the viewport).
|
||||
|
||||
This approach ensures that no matter how big the table, only a small number of columns/rows need to be
|
||||
|
||||
@@ -1,24 +1,29 @@
|
||||
Views
|
||||
=====
|
||||
|
||||
Layout
|
||||
======
|
||||
|
||||
Creating Custom Views
|
||||
=====================
|
||||
|
||||
Constructor
|
||||
-----------
|
||||
|
||||
Rendering
|
||||
---------
|
||||
|
||||
### Using Custom Colors
|
||||
|
||||
Keyboard processing
|
||||
-------------------
|
||||
|
||||
Mouse event processing
|
||||
----------------------
|
||||
|
||||
*Terminal.Gui* provides a rich set of views and controls for building terminal user interfaces:
|
||||
|
||||
* [Button](~/api/Terminal.Gui/Terminal.Gui.Button.html)
|
||||
* [CheckBox](~/api/Terminal.Gui/Terminal.Gui.CheckBox.html)
|
||||
* [ColorPicker](~/api/Terminal.Gui/Terminal.Gui.ColorPicker.html)
|
||||
* [ComboBox](~/api/Terminal.Gui/Terminal.Gui.ComboBox.html)
|
||||
* [Dialog](~/api/Terminal.Gui/Terminal.Gui.Dialog.html)
|
||||
* [OpenDialog](~/api/Terminal.Gui/Terminal.Gui.OpenDialog.html)
|
||||
* [SaveDialog](~/api/Terminal.Gui/Terminal.Gui.SaveDialog.html)
|
||||
* [FrameView](~/api/Terminal.Gui/Terminal.Gui.FrameView.html)
|
||||
* [GraphView](~/api/Terminal.Gui/Terminal.Gui.GraphView.html)
|
||||
* [Hex viewer/editor](~/api/Terminal.Gui/Terminal.Gui.HexView.html)
|
||||
* [Label](~/api/Terminal.Gui/Terminal.Gui.Label.html)
|
||||
* [ListView](~/api/Terminal.Gui/Terminal.Gui.ListView.html)
|
||||
* [Menu](~/api/Terminal.Gui/Terminal.Gui.MenuBar.html)
|
||||
* [MessageBox](~/api/Terminal.Gui/Terminal.Gui.MessageBox.html)
|
||||
* [ProgressBar](~/api/Terminal.Gui/Terminal.Gui.ProgressBar.html)
|
||||
* [Radio buttons](~/api/Terminal.Gui/Terminal.Gui.RadioGroup.html)
|
||||
* [TableView](~/api/Terminal.Gui/Terminal.Gui.TableView.html)
|
||||
* [Time & Date Fields](~/api/Terminal.Gui/Terminal.Gui.TimeField.html)
|
||||
* [TextField](~/api/Terminal.Gui/Terminal.Gui.TextField.html)
|
||||
* [TextValidateField](~/api/Terminal.Gui/Terminal.Gui.TextValidateField.html)
|
||||
* [TextView (Text Editor)](~/api/Terminal.Gui/Terminal.Gui.TextView.html)
|
||||
* [TreeView](~/api/Terminal.Gui/Terminal.Gui.TreeView.html)
|
||||
* [ScrollView](~/api/Terminal.Gui/Terminal.Gui.ScrollView.html)
|
||||
* [ScrollBarView](~/api/Terminal.Gui/Terminal.Gui.ScrollBarView.html)
|
||||
* [StatusBar](~/api/Terminal.Gui/Terminal.Gui.StatusBar.html)
|
||||
* [Window](~/api/Terminal.Gui/Terminal.Gui.Window.html)
|
||||
* [Wizard](~/api/Terminal.Gui/Terminal.Gui.Wizard.html)
|
||||
|
||||
@@ -7,6 +7,7 @@ A simple UI toolkit for .NET, .NET Core, and Mono that works on Windows, the Mac
|
||||
## Terminal.Gui API Documentation
|
||||
|
||||
* [API Reference](~/api/Terminal.Gui/Terminal.Gui.yml)
|
||||
* [Views and controls built into the Terminal.Gui library](~/articles/views.md)
|
||||
* [Terminal.Gui API Overview](~/articles/overview.md)
|
||||
* [Keyboard Event Processing](~/articles/keyboard.md)
|
||||
* [Event Processing and the Application Main Loop](~/articles/mainloop.md)
|
||||
|
||||
Reference in New Issue
Block a user