From 38d663c267f41e093c1d703aec71a3137c9d5f59 Mon Sep 17 00:00:00 2001 From: Oliver <480930+rivo@users.noreply.github.com> Date: Sat, 13 Jan 2018 13:07:05 +0100 Subject: [PATCH] In Form, changed GetElement() to GetFormItem() for consistency reasons. --- demos/unicode/main.go | 4 ++-- form.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/demos/unicode/main.go b/demos/unicode/main.go index ac46716..ee2e3ea 100644 --- a/demos/unicode/main.go +++ b/demos/unicode/main.go @@ -17,8 +17,8 @@ func main() { AddCheckbox("年龄 18+", false, nil). AddPasswordField("密码", "", 10, '*', nil). AddButton("保存", func() { - _, title := form.GetElement(0).(*tview.DropDown).GetCurrentOption() - userName := form.GetElement(1).(*tview.InputField).GetText() + _, title := form.GetFormItem(0).(*tview.DropDown).GetCurrentOption() + userName := form.GetFormItem(1).(*tview.InputField).GetText() alert(pages, "alert-dialog", fmt.Sprintf("保存成功,%s %s!", userName, title)) }). diff --git a/form.go b/form.go index ab8bd6e..ca86eca 100644 --- a/form.go +++ b/form.go @@ -191,10 +191,10 @@ func (f *Form) AddButton(label string, selected func()) *Form { return f } -// GetElement returns the form element at the given position, starting with +// 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. -func (f *Form) GetElement(index int) Primitive { +func (f *Form) GetFormItem(index int) FormItem { return f.items[index] }