Show / Hide Table of Contents

    Class Toplevel

    Toplevel views can be modally executed.
    Inheritance
    System.Object
    Responder
    View
    Toplevel
    Window
    Implements
    System.Collections.IEnumerable
    Inherited Members
    View.Enter
    View.Leave
    View.MouseEnter
    View.MouseLeave
    View.Driver
    View.Subviews
    View.Id
    View.IsCurrentTop
    View.WantMousePositionReports
    View.WantContinuousButtonPressed
    View.Frame
    View.GetEnumerator()
    View.LayoutStyle
    View.Bounds
    View.X
    View.Y
    View.Width
    View.Height
    View.SuperView
    View.SetNeedsDisplay()
    View.SetNeedsDisplay(Rect)
    View.ChildNeedsDisplay()
    View.Add(View[])
    View.BringSubviewToFront(View)
    View.SendSubviewToBack(View)
    View.SendSubviewBackwards(View)
    View.BringSubviewForward(View)
    View.Clear()
    View.Clear(Rect)
    View.ScreenToView(Int32, Int32)
    View.ClipToBounds()
    View.SetClip(Rect)
    View.DrawFrame(Rect, Int32, Boolean)
    View.DrawHotString(ustring, Attribute, Attribute)
    View.DrawHotString(ustring, Boolean, ColorScheme)
    View.Move(Int32, Int32)
    View.PositionCursor()
    View.HasFocus
    View.OnEnter()
    View.OnLeave()
    View.Focused
    View.MostFocused
    View.ColorScheme
    View.AddRune(Int32, Int32, Rune)
    View.ClearNeedsDisplay()
    View.SetFocus(View)
    View.KeyPress
    View.ProcessHotKey(KeyEvent)
    View.ProcessColdKey(KeyEvent)
    View.KeyDown
    View.OnKeyDown(KeyEvent)
    View.KeyUp
    View.OnKeyUp(KeyEvent)
    View.EnsureFocus()
    View.FocusFirst()
    View.FocusLast()
    View.FocusPrev()
    View.FocusNext()
    View.LayoutSubviews()
    View.ToString()
    View.OnMouseEnter(MouseEvent)
    View.OnMouseLeave(MouseEvent)
    Responder.MouseEvent(MouseEvent)
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Terminal.Gui
    Assembly: Terminal.Gui.dll
    Syntax
    public class Toplevel : View, IEnumerable
    Remarks

    Toplevels can be modally executing views, and they return control to the caller when the "Running" property is set to false, or by calling Terminal.Gui.Application.RequestStop()

    There will be a toplevel created for you on the first time use and can be accessed from the property Top, but new toplevels can be created and ran on top of it. To run, create the toplevel and then invoke Run() with the new toplevel.

    TopLevels can also opt-in to more sophisticated initialization by implementing System.ComponentModel.ISupportInitialize. When they do so, the System.ComponentModel.ISupportInitialize.BeginInit and System.ComponentModel.ISupportInitialize.EndInit methods will be called before running the view. If first-run-only initialization is preferred, the System.ComponentModel.ISupportInitializeNotification can be implemented too, in which case the System.ComponentModel.ISupportInitialize methods will only be called if System.ComponentModel.ISupportInitializeNotification.IsInitialized is false. This allows proper View inheritance hierarchies to override base class layout code optimally by doing so only on first run, instead of on every run.

    Constructors

    Toplevel()

    Initializes a new instance of the Toplevel class with Computed layout, defaulting to async full screen.
    Declaration
    public Toplevel()

    Toplevel(Rect)

    Initializes a new instance of the Toplevel class with the specified absolute layout.
    Declaration
    public Toplevel(Rect frame)
    Parameters
    Type Name Description
    Rect frame Frame.

    Properties

    CanFocus

    Gets or sets a value indicating whether this Toplevel can focus.
    Declaration
    public override bool CanFocus { get; }
    Property Value
    Type Description
    System.Boolean true if can focus; otherwise, false.
    Overrides
    Responder.CanFocus

    MenuBar

    Check id current toplevel has menu bar
    Declaration
    public MenuBar MenuBar { get; set; }
    Property Value
    Type Description
    MenuBar

    Modal

    Determines whether the Toplevel is modal or not. Causes ProcessKey(KeyEvent) to propagate keys upwards by default unless set to true.
    Declaration
    public bool Modal { get; set; }
    Property Value
    Type Description
    System.Boolean

    Running

    Gets or sets whether the Mainloop for this Toplevel is running or not. Setting this property to false will cause the MainLoop to exit.
    Declaration
    public bool Running { get; set; }
    Property Value
    Type Description
    System.Boolean

    StatusBar

    Check id current toplevel has status bar
    Declaration
    public StatusBar StatusBar { get; set; }
    Property Value
    Type Description
    StatusBar

    Methods

    Add(View)

    Declaration
    public override void Add(View view)
    Parameters
    Type Name Description
    View view
    Overrides
    View.Add(View)

    Create()

    Convenience factory method that creates a new toplevel with the current terminal dimensions.
    Declaration
    public static Toplevel Create()
    Returns
    Type Description
    Toplevel The create.

    ProcessKey(KeyEvent)

    Declaration
    public override bool ProcessKey(KeyEvent keyEvent)
    Parameters
    Type Name Description
    KeyEvent keyEvent
    Returns
    Type Description
    System.Boolean
    Overrides
    View.ProcessKey(KeyEvent)

    Redraw(Rect)

    Declaration
    public override void Redraw(Rect region)
    Parameters
    Type Name Description
    Rect region
    Overrides
    View.Redraw(Rect)

    Remove(View)

    Declaration
    public override void Remove(View view)
    Parameters
    Type Name Description
    View view
    Overrides
    View.Remove(View)

    RemoveAll()

    Declaration
    public override void RemoveAll()
    Overrides
    View.RemoveAll()

    WillPresent()

    This method is invoked by Application.Begin as part of the Application.Run after the views have been laid out, and before the views are drawn for the first time.
    Declaration
    public virtual void WillPresent()

    Events

    Ready

    Fired once the Toplevel's MainLoop has started it's first iteration. Subscribe to this event to perform tasks when the Toplevel has been laid out and focus has been set. changes. A Ready event handler is a good place to finalize initialization after calling `Run()(topLevel)`.
    Declaration
    public event EventHandler Ready
    Event Type
    Type Description
    System.EventHandler

    Implements

    System.Collections.IEnumerable
    Back to top Generated by DocFX