gitlabEdit

square-infoInformational Boxes

Information in a box

When you want to present information to the user in a form of a dialog box, you'll want to use this feature that presents you with a wide variety of informational box styles to choose from, depending on the purpose.


Types of info boxes

Some informational box styles are modal, while others are non-modal.

Modal infoboxes are informational boxes that are displayed on the terminal, waiting for user input. However, non-modal infoboxes are boxes that are just displayed for informational purposes, such as reporting a progress non-deterministically. Selection-based inputs can be searched using regular expressions compatible with the .NET syntax.

The following informational box styles are presented in this way:

Modality
Type
Description

Modal

Buttons

Info box that tells users to choose one of three buttons

Input

Info box that tells users to write a string in clear text

Input (password)

Info box that tells users to write a string with masking

Input (character)

Info box that tells users to write a single character

Multi-input

Info box that tells users to provide multiple inputs

Modal dialog box

Info box that tells users to read text in it before exiting

Slider

Info box that tells users to select an integral value visually

Selection

Info box that tells users to select an option

Multi selection

Info box that tells users to select multiple options

Non-modal

Dialog box

Info box that shows users a text box

Progress

Info box that shows users a text box with progress


Info box configuration

You can configure the infoboxes and how they appear and/or behave using the InfoBoxSettings class. You can access the global settings using the GlobalSettings property.

This class contains the following properties:

Property
Description

Title

A short title to describe the infobox

BorderSettings

Controls how the borders are rendered

ForegroundColor

Foreground color of the infobox (including border, title, and content)

BackgroundColor

Background color of the infobox

UseColors

Whether to use the colors or not (default is true)

RadioButtons

Whether to use the radio buttons or not (for single-choice selection infoboxes)

Positioning

Determines the positioning of the infobox

UsePopover

Uses the popover for multi-input selection infoboxes (input modules should handle popovers)

circle-info

Until Terminaux 7.0, you can still use the argument-based overloads when making a new infobox. Those overloads, however, are deprecated and you should use the InfoBoxSettings instance instead.


Info box class

All informational boxes, modal or non-modal, utilizes the InfoBox class to specify how to write the informational box to the console, such as positioning, text, and settings.

Non-modal informational boxes can also be used as a pseudo-cyclic writer because it has a function called Render(), which behaves similarly to that of a cyclic writer by returning a buffer that would get printed to a console as a string.

This function allows you to provide the following arguments:

Property
Description

increment

Incrementation rate for paged text in the text area (usually passed initialized to 0)

currIdx

Current index of text line in the text area

drawBar

Whether to draw the slider bar for the text area or not

writeBinding

Whether to write the key bindings in the upper right corner of the box or not

You can also erase them manually if you have an info box instance using the Erase() function. Non-modal informational boxes can also be erased manually, because the functions return the info box instance, which allows you to erase the infobox using the Erase() function. You'll need to print the result to the console, though, using the raw console writer.

circle-info

If you provided increment as a ref variable, all the arguments that come after it will be required.


Informational box styles of this nature are modal. They require either a keyboard input or a mouse input from the end user in order to present information to the user with action. These boxes are common in interactive console applications where information is to be conveyed to the user.

chevron-rightButtonshashtag

This style utilizes choice-based input to render the buttons inside the informational box of this style, which makes them look like a conventional dialog box.

This style can render up to three buttons from the right to the left, which means three instances of InputChoiceInfo. You can use this style with the InfoBoxButtonsColor class.

chevron-rightInputhashtag

This style uses the input reader to tell the user to write something, based on the informational box contents.

For example, if this informational box tells an end-user to write a hostname of an SFTP server, the user will have to write the hostname.

You can use this style with InfoBoxInputColor.

chevron-rightInput (password)hashtag

This style uses the input reader masked with the password to tell the user to write something, based on the informational box contents.

For example, if this informational box tells an end-user to write a password of an account when logging in to the SFTP server, the user will have to write the password.

You can use this style with InfoBoxInputColor with specifying the InfoBoxInputType as Password.

chevron-rightInput (character)hashtag

This style uses the input reader that takes the first character from the input string, based on the informational box contents.

For example, if this informational box tells an end-user to write a character to specify a box border character, the user will have to write it.

You can use this style with InfoBoxInputColor with specifying the InfoBoxInputType as Character.

chevron-rightMulti-inputhashtag

This style uses the input modules to describe multiple ways to present input to the user using different modules, such as having a text box and a combo box at the same time.

You can use this style with InfoBoxMultiInputColor.

circle-info

To learn more about input modules, consult the page below:

Input Modules

chevron-rightNormal modal info boxhashtag

This style only prints information that the end user needs to read. This is suitable for information that doesn't need any action.

You can use this style with the InfoBoxModalColor class.

chevron-rightSliderhashtag

This style allows you to define the minimum, current, and maximum value of an integral value that is surrounded by the specified range.

xminvaluexmaxx_{min} \le value \le x_{max}

For example, a slider that has a minimum value of 5 and a maximum value of 10 can only accept values of between 5 and 10, which means 5, 6, 7, 8, 9, and 10.

You can use this style with the InfoBoxSliderColor class.

Controls

You can use left arrow to decrement a value by 1, and you can use right arrow to increment a value by 1.

If you're holding the SHIFT key while pressing the mentioned arrow keys, you'll decrement or increment a value by 100.

You can use the spacebar to manually enter the value, in case using arrow keys is unfeasible even with SHIFT.

chevron-rightSelection styleshashtag

These are the informational boxes that use choice-style input styles.

Infobox styles

There are two styles in this category:

  • Single selection

  • Multiple selection

Single selection informational box

This info box style uses the choice-based input to define choices that the end user will have to select one of them. Plus, you can search for a choice using the F key to initiate a regex-based search for maximum flexibility.

You can use this style with the InfoBoxSelectionColor class.

circle-info

You can additionally enable radio buttons using the RadioButtons property in the infobox settings.

Multiple selection informational box

This info box style uses the choice-based input to define multiple choices that the end user will have to select one of them. Plus, you can search for a choice using the F key to initiate a regex-based search for maximum flexibility.

You can use this style with the InfoBoxSelectionMultipleColor class.

Defining choices

For informational boxes that use choice-based input styles, you can discover how to define choices by visiting this page:

Choice-based inputs

circle-info

Every single modal informational box style contain their own help page which you can access via the K key. They support both keyboard and mouse.

circle-info

If you want to create a custom modal infobox not covered in any of the below pre-defined infobox styles, you'll have to refer to their source codearrow-up-right and create the style handler yourself.


Non-modal informational boxes

In addition to the modal informational boxes, we also have non-modal informational boxes that don't wait for user input, but gets rendered once per call.

chevron-rightNormal infoboxhashtag

This is used to convey information to the end user that some progress is being made without any percentage. Such progress is called indeterminate progress. However, this can be used to display a disclaimer or any other information within a limited time.

chevron-rightProgresshashtag

This is used to tell the end user through an informational box with a progress bar that something is happening, and that the progress is being done all the way to 100%. This infobox needs to be in a loop while progress is being made.


Infobox positioning

All informational boxes support positioning, because they expose a writable property called Positioning in the InfoBoxSettings class. It can be configured globally using the GlobalSettings property found in the InfoBoxPositioning class.

The following properties can be used to position the informational box however you want:

Property
Description

Autofit

If turned on, the informational box will be automatically placed in the middle of the screen, growing according to the textual content. If turned off, the informational box will be rendered based on the below positioning values.

Left

Zero-based left position of the infobox

Top

Zero-based top position of the infobox

Width

Width of the infobox (excluding the extra width) (default: 50)

Height

Height of the infobox (excluding the extra height) (default: 5)

ExtraWidth

Reserved width for the informational box that may store wider elements than the text itself (keep zero for text only)

ExtraHeight

Reserved height for elements that will be placed after the information text (keep zero for text only)

Turning off autofit for infoboxes, while keeping default configuration, will result in this:

Last updated