andlabs / ui

Platform-native GUI library for Go.
Other
8.34k stars 647 forks source link

Any way to get form children? #348

Open deadline527 opened 5 years ago

deadline527 commented 5 years ago

So currently I am using a method to get the children of the form, but as its not part of the andlabs ui it gets removed on dep ensure.

func (f *Form) Count() int {
    count := len(f.children)
    return count
}

Is there a better way to be doing this? I need this functionality to refresh the form on button click such as, so I can allow the UI to be more dynamic.

func clearForm(entryForm *ui.Form) {
    for entryForm.Count() > 0 {
        for x := 0; x <= entryForm.Count(); x++ {
            entryForm.Delete(0)
        }
    }
}