(label, value string, fieldWidth int, accept func(textToCheck string, lastChar rune) bool, changed func(text string))
| 126 | } |
| 127 | |
| 128 | func (f *XForm) AddInputField(label, value string, fieldWidth int, accept func(textToCheck string, lastChar rune) bool, changed func(text string)) *XForm { |
| 129 | inputField := tview.NewInputField() |
| 130 | f.AddFormItem(inputField. |
| 131 | SetFieldStyle(tcell.StyleDefault.Background(tcell.ColorWhite).Foreground(tcell.ColorBlack)). |
| 132 | SetPlaceholderStyle(DefaultTheme.PlaceholderStyle). |
| 133 | SetPlaceholderTextColor(DefaultTheme.PlaceholderTextColor). |
| 134 | SetLabel(label). |
| 135 | SetText(value). |
| 136 | SetFieldWidth(fieldWidth). |
| 137 | SetAcceptanceFunc(accept). |
| 138 | SetChangedFunc(changed)) |
| 139 | |
| 140 | return f |
| 141 | } |
| 142 | |
| 143 | func (f *XForm) AddTextArea(label string, text string, fieldWidth, fieldHeight int, maxLength int, changed func(text string)) *XForm { |
| 144 | if fieldHeight == 0 { |
no outgoing calls
no test coverage detected