termfields

package module
v0.0.0-...-95787a8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2018 License: MIT Imports: 2 Imported by: 0

README

Termfields

Synopsis

A Go Library for creating and updating console based UIs.

Installation

go get -u github.com/uxbh/termfields

Contributors

Written by Unixblackhole

License

See License

Documentation

Overview

Package termfields creates updateable form fields at specified locations in the console.

Index

Constants

View Source
const (
	BoxStyleNone boxStyle
	BoxStyleASCII
	BoxStyleUnicode
)

Flags to style a box border around a field

View Source
const (
	FieldShiftLeft shiftDir = iota
	FieldShiftRight
	FieldShiftUp
	FieldShiftDown
)

Flags to Shift a field in a specified direction

Variables

This section is empty.

Functions

func Close

func Close()

Close Finalizes termbox library, should be called after successful initialization when termbox's functionality isn't required anymore.

func Init

func Init() error

Init Initializes termfields library. This function should be called before any other functions. After successful initialization, the library must be finalized using 'Close' function.

Example usage:

err := termfields.Init()
if err != nil {
        panic(err)
}
defer termfields.Close()

Types

type Field

type Field struct {
	// contains filtered or unexported fields
}

Field is the identifier for a specific form field on the screen.

func NewField

func NewField(y, x, len int, text string) (*Field, error)

NewField creates a new field at location y,x of lenth len with contents text.

func (*Field) Column

func (f *Field) Column() int

Column returns the column of a field.

func (*Field) DrawBox

func (f *Field) DrawBox(boxType boxStyle) error

DrawBox draws or clears a box around a given field.

func (*Field) Loc

func (f *Field) Loc(y, x int)

Loc defines a new location for a field.

func (*Field) Row

func (f *Field) Row() int

Row returns the row of a field.

func (*Field) Shift

func (f *Field) Shift(dir shiftDir)

Shift shifts a field a direction based on the value of a moveDir

func (*Field) Update

func (f *Field) Update(s string) error

Update changes the text for a field

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL