Skip to content
FutureBlitz

    Install

    Import std.term.views

    std.term.views

    std.term's views for full-screen apps, each drawn on a Canvas in a Region, which take the keys and the mouse's events that are theirs: a TextInput, a line of text that's edited as a shell's is, and a ListView, a list of items with one selected, which scrolls to keep it in view.

    std/term/views.fb

    Types

    TextInput class

    Public Class TextInput

    A line of text to type in, edited as a shell's line is (see LineEditor's Handle), which Draw shows in a Region's first row, scrolled sideways to keep its cursor in view. A Placeholder shows while it's empty, and a Mask, like "•", in place of each character, as for a password.

    std/term/views.fb, line 164

    • Public Field Placeholder: String field #

      What shows while it's empty.

    • Public Field Mask: String field #

      What shows in place of each character, like "•", or "" for the characters themselves.

    • Public Field TextLook: Style field #

      How its text looks, and its placeholder.

    • Public Field PlaceholderLook: Style field #

      How its placeholder looks.

    • Public New(text: String = "") constructor #

      An input holding text, its cursor after it.

    • Public Property Text: String property #

      What's typed; setting it puts the cursor at its end.

    • Public Property Cursor: Int property #

      Where the cursor is, a byte position in Text.

    • Public Method HandleKey(key: KeyEvent): Bool method #

      Edits it as key says, and gives whether the key was one it takes.

    • Public Method HandleEvent(event: InputEvent): Bool method #

      Takes a key, or what's pasted, its line breaks as spaces, and gives whether it took it.

    • Public Method Draw(canvas: Canvas, area: Region): Int method #

      Draws it in area's first row, and gives the column its cursor is at, for a Screen's ShowCursor.

    ListView class

    Public Class ListView

    A list of Items, one of which is Selected, which Draw shows in a Region, scrolled to keep the selected one in view, with its Marker before it and drawn in SelectedLook, over ItemLook. HandleKey moves the selection with Up, Down, Page Up, Page Down, Home, and End, and HandleMouse with a click or the wheel.

    std/term/views.fb, line 251

    • Public Field Items: String[] field #

      Its items, in order.

    • Public Field Marker: String field #

      What's before the selected item, with as many spaces before each other one.

    • Public Field ItemLook: Style field #

      How the items look.

    • Public Field SelectedLook: Style field #

      How the selected item looks.

    • Public New(items: String[]) constructor #

      A list of items, the first selected.

    • Public Property Selected: Int property #

      Which item is selected, from 0, or -1 for an empty list. Setting it keeps it in the list.

    • Public Property SelectedItem: String? property #

      The selected item, or Null for an empty list.

    • Public Method HandleKey(key: KeyEvent): Bool method #

      Moves the selection as key says, and gives whether it was one of its keys, which an empty list has none of.

    • Public Method HandleMouse(mouse: MouseEvent, area: Region): Bool method #

      Selects the item a press of the left button in area is on, or moves the selection three items for the wheel, and gives whether it did.

    • Public Method HandleEvent(event: InputEvent, area: Region): Bool method #

      Takes a key or the mouse's event in area, and gives whether it took it.

    • Public Method Draw(canvas: Canvas, area: Region) method #

      Draws the items that fit in area, one a row, scrolled to keep the selected one in view.

    Report an issue with this page or with FutureBlitz on GitHub.