mirror of https://github.com/rivo/tview.git
Form now has a Clear() function. Resolves #32
This commit is contained in:
parent
9608f5b3b5
commit
c105638ec3
2
box.go
2
box.go
|
@ -94,7 +94,7 @@ func (b *Box) GetInnerRect() (int, int, int, int) {
|
|||
height - b.paddingTop - b.paddingBottom
|
||||
}
|
||||
|
||||
// SetRect sets a new position of the rectangle.
|
||||
// SetRect sets a new position of the primitive.
|
||||
func (b *Box) SetRect(x, y, width, height int) {
|
||||
b.x = x
|
||||
b.y = y
|
||||
|
|
10
form.go
10
form.go
|
@ -191,6 +191,16 @@ func (f *Form) AddButton(label string, selected func()) *Form {
|
|||
return f
|
||||
}
|
||||
|
||||
// Clear removes all input elements from the form, including the buttons if
|
||||
// specified.
|
||||
func (f *Form) Clear(includeButtons bool) *Form {
|
||||
f.items = nil
|
||||
if includeButtons {
|
||||
f.buttons = nil
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
// GetFormItem returns the form element at the given position, starting with
|
||||
// index 0. Elements are referenced in the order they were added. Buttons are
|
||||
// not included.
|
||||
|
|
Loading…
Reference in New Issue