Browse Source

Form now has a Clear() function. Resolves #32

merge-requests/1/merge
Oliver 5 years ago
parent
commit
c105638ec3
  1. 2
      box.go
  2. 10
      form.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

@ -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…
Cancel
Save