Table of Contents

Class Application

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

A static, singleton class representing the application. This class is the entry point for the application.

public static class Application
Inheritance
Application
Inherited Members

Examples

Application.Init();
var win = new Window ($"Example App ({Application.QuitKey} to quit)");
Application.Run(win);
win.Dispose();
Application.Shutdown();

Remarks

TODO: Flush this out.

Properties

AlternateBackwardKey

Alternative key to navigate backwards through views. Shift+Ctrl+Tab is the primary key.

AlternateForwardKey

Alternative key to navigate forwards through views. Ctrl+Tab is the primary key.

Current

The current Toplevel object. This is updated in Begin(Toplevel) enters and leaves to point to the current Toplevel .

Driver

Gets the ConsoleDriver that has been selected. See also ForceDriver.

EndAfterFirstIteration

Set to true to cause End(RunState) to be called after the first iteration. Set to false (the default) to cause the application to continue running until Application.RequestStop () is called.

Force16Colors

Gets or sets whether Driver will be forced to output only the 16 colors defined in ColorName. The default is false, meaning 24-bit (TrueColor) colors will be output as long as the selected ConsoleDriver supports TrueColor.

ForceDriver

Forces the use of the specified driver (one of "fake", "ansi", "curses", "net", or "windows"). If not specified, the driver is selected based on the platform.

IsMouseDisabled

Disable or enable the mouse. The mouse is enabled by default.

MouseGrabView

Gets the view that grabbed the mouse (e.g. for dragging). When this is set, all mouse events will be routed to this view until the view calls UngrabMouse() or the mouse is released.

OverlappedChildren

Gets the list of the Overlapped children which are not modal Toplevel from the OverlappedTop.

OverlappedTop

The Toplevel object used for the application on startup which IsOverlappedContainer is true.

QuitKey

Gets or sets the key to quit the application.

SupportedCultures

Gets all cultures supported by the application without the invariant language.

Top

The Toplevel object used for the application on startup (Top)

WantContinuousButtonPressedView

The current View object that wants continuous mouse button pressed events.

Methods

AddTimeout(TimeSpan, Func<bool>)

Adds a timeout to the application.

Begin(Toplevel)

Building block API: Prepares the provided Toplevel for execution.

BringOverlappedTopToFront()

Brings the superview of the most focused overlapped view is on front.

End(RunState)

Building block API: completes the execution of a Toplevel that was started with Begin(Toplevel) .

GetDriverTypes()

Gets of list of ConsoleDriver types that are available.

GetTopOverlappedChild(Type, string[])

Gets the current visible Toplevel overlapped child that matches the arguments pattern.

GrabMouse(View)

Grabs the mouse, forcing all mouse events to be routed to the specified view until UngrabMouse() is called.

Init(ConsoleDriver, string)

Initializes a new instance of Terminal.Gui Application.

Invoke(Action)

Runs action on the thread that is processing events

MoveToOverlappedChild(Toplevel)

Move to the next Overlapped child from the OverlappedTop and set it as the Top if it is not already.

OnKeyDown(Key)

Called by the ConsoleDriver when the user presses a key. Fires the KeyDown event then calls NewKeyDownEvent(Key) on all top level views. Called after OnKeyDown(Key) and before OnKeyUp(Key).

OnKeyUp(Key)

Called by the ConsoleDriver when the user releases a key. Fires the KeyUp event then calls NewKeyUpEvent(Key) on all top level views. Called after OnKeyDown(Key).

OnSizeChanging(SizeChangedEventArgs)

Called when the application's size changes. Sets the size of all Toplevels and fires the SizeChanging event.

OverlappedMoveNext()

Move to the next Overlapped child from the OverlappedTop.

OverlappedMovePrevious()

Move to the previous Overlapped child from the OverlappedTop.

Refresh()

Triggers a refresh of the entire display.

RemoveTimeout(object)

Removes a previously scheduled timeout

RequestStop(Toplevel)

Stops the provided Toplevel, causing or the top if provided.

Run(Func<Exception, bool>, ConsoleDriver)

Runs the application by creating a Toplevel object and calling Run(Toplevel, Func<Exception, bool>, ConsoleDriver).

Run(Toplevel, Func<Exception, bool>, ConsoleDriver)

Runs the Application using the provided Toplevel view.

RunIteration(ref RunState, ref bool)

Run one application iteration.

RunLoop(RunState)

Building block API: Runs the main loop for the created Toplevel.

Run<T>(Func<Exception, bool>, ConsoleDriver)

Runs the application by creating a Toplevel-derived object of type T and calling Run(Toplevel, Func<Exception, bool>, ConsoleDriver).

Shutdown()

Shutdown an application initialized with Init(ConsoleDriver, string).

UngrabMouse()

Releases the mouse grab, so mouse events will be routed to the view on which the mouse is.

Wakeup()

Wakes up the running application that might be waiting on input.

Events

GrabbedMouse

Invoked after a view has grabbed the mouse.

GrabbingMouse

Invoked when a view wants to grab the mouse; can be canceled.

Iteration

This event is raised on each iteration of the main loop.

KeyDown

Event fired when the user presses a key. Fired by OnKeyDown(Key).

Set Handled to true to indicate the key was handled and to prevent additional processing.

KeyUp

Event fired when the user releases a key. Fired by OnKeyUp(Key).

Set Handled to true to indicate the key was handled and to prevent additional processing.

MouseEvent

Event fired when a mouse move or click occurs. Coordinates are screen relative.

NotifyNewRunState

Notify that a new RunState was created (Begin(Toplevel) was called). The token is created in Begin(Toplevel) and this event will be fired before that function exits.

NotifyStopRunState

Notify that a existent RunState is stopping (End(RunState) was called).

SizeChanging

Invoked when the terminal's size changed. The new size of the terminal is provided.

UnGrabbedMouse

Invoked after a view has un-grabbed the mouse.

UnGrabbingMouse

Invoked when a view wants un-grab the mouse; can be canceled.