diff --git a/textinput.go b/textinput.go index 69a4106..3805106 100644 --- a/textinput.go +++ b/textinput.go @@ -31,15 +31,25 @@ func NewTextInput (text string) *TextInput { return this } -// SetText sets the text content of the input. -func (this *TextInput) SetText (text string) { +// SetValue sets the text content of the input. +func (this *TextInput) SetValue (text string) { this.text = []rune(text) this.TextBox.SetText(text) } +// Value returns the text content of the input. +func (this *TextInput) Value () string { + return string(this.text) +} + +// SetText sets the text content of the input. +func (this *TextInput) SetText (text string) { + this.SetValue(text) +} + // Text returns the text content of the input. func (this *TextInput) Text () string { - return string(this.text) + return this.Value() } // OnConfirm specifies a function to be called when the user presses enter