Documentation ¶
Index ¶
- Variables
- type TextField
- func (field *TextField) CanCopy() bool
- func (field *TextField) CanCut() bool
- func (field *TextField) CanDelete() bool
- func (field *TextField) CanPaste() bool
- func (field *TextField) CanSelectAll() bool
- func (field *TextField) Copy()
- func (field *TextField) Cut()
- func (field *TextField) Delete()
- func (field *TextField) FromSelectionIndex(index int) geom.Point
- func (field *TextField) HasSelectionRange() bool
- func (field *TextField) Paste()
- func (field *TextField) SelectAll()
- func (field *TextField) SelectedText() string
- func (field *TextField) Selection() (start, end int)
- func (field *TextField) SelectionCount() int
- func (field *TextField) SetSelection(start, end int)
- func (field *TextField) SetSelectionTo(pos int)
- func (field *TextField) SetSelectionToEnd()
- func (field *TextField) SetSelectionToStart()
- func (field *TextField) SetText(text string) bool
- func (field *TextField) SetWatermark(text string)
- func (field *TextField) Sizes(hint geom.Size) (min, pref, max geom.Size)
- func (field *TextField) Text() string
- func (field *TextField) ToSelectionIndex(x float64) int
- func (field *TextField) Watermark() string
- type Theme
Constants ¶
This section is empty.
Variables ¶
var ( // StdTheme is the theme all new TextFields get by default. StdTheme = NewTheme() )
Functions ¶
This section is empty.
Types ¶
type TextField ¶
type TextField struct { widget.Block Theme *Theme // The theme the text field will use to draw itself. // contains filtered or unexported fields }
TextField provides a single-line text input control.
func (*TextField) CanDelete ¶
CanDelete returns true if the field has a selection that can be deleted.
func (*TextField) CanPaste ¶
CanPaste returns true if the clipboard has content that can be pasted into the field.
func (*TextField) CanSelectAll ¶
CanSelectAll returns true if the field's selection can be expanded.
func (*TextField) Delete ¶
func (field *TextField) Delete()
Delete removes the currently selected text, if any.
func (*TextField) FromSelectionIndex ¶
FromSelectionIndex returns a location in local coordinates for the specified rune index.
func (*TextField) HasSelectionRange ¶
HasSelectionRange returns true is a selection range is currently present.
func (*TextField) Paste ¶
func (field *TextField) Paste()
Paste any text on the clipboard into the field.
func (*TextField) SelectAll ¶
func (field *TextField) SelectAll()
SelectAll selects all of the text in the field.
func (*TextField) SelectedText ¶
SelectedText returns the currently selected text.
func (*TextField) SelectionCount ¶
SelectionCount returns the number of characters currently selected.
func (*TextField) SetSelection ¶
SetSelection sets the start and end range of the selection. Values beyond either end will be constrained to the appropriate end. Likewise, an end value less than the start value will be treated as if the start and end values were the same.
func (*TextField) SetSelectionTo ¶
SetSelectionTo moves the cursor to the specified index and removes any range that may have been present.
func (*TextField) SetSelectionToEnd ¶
func (field *TextField) SetSelectionToEnd()
SetSelectionToEnd moves the cursor to the end of the text and removes any range that may have been present.
func (*TextField) SetSelectionToStart ¶
func (field *TextField) SetSelectionToStart()
SetSelectionToStart moves the cursor to the beginning of the text and removes any range that may have been present.
func (*TextField) SetText ¶
SetText sets the content of the field. Returns true if a modification was made.
func (*TextField) SetWatermark ¶
SetWatermark sets the watermark. The watermark is used to give the user a hint about what the field is for when it is empty.
func (*TextField) ToSelectionIndex ¶
ToSelectionIndex returns the rune index for the specified x-coordinate.
type Theme ¶
type Theme struct { Font *font.Font // The font to use. Border border.Border // The border to use when not focused. FocusBorder border.Border // The border to use when focused. BlinkRate time.Duration // The rate at which the cursor blinks. MinimumTextWidth float64 // The minimum space to permit for text. DisabledBackgroundColor color.Color // The color to use for the background when disabled. InvalidBackgroundColor color.Color // The color to use for the background when marked invalid. }
Theme contains the theme elements for TextFields.