From 1b8b31a123f51b617903d1cab83342444c1c0a7e Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 3 Nov 2021 23:25:57 -0500 Subject: [PATCH] EDITBOX: pull in a edit box example Signed-off-by: Jeff Carr --- demo-window.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/demo-window.go b/demo-window.go index 16566c4..f15f3ee 100644 --- a/demo-window.go +++ b/demo-window.go @@ -26,3 +26,48 @@ func (n *Node) AddGroup(title string) *Node { newNode.uiBox = vbox return newNode } + +func (n *Node) MakeBasicControlsPage(title string) *Node { + if (n == nil) { + return nil + } + origbox := n.uiBox + if (origbox == nil) { + return n + } + + vbox := ui.NewVerticalBox() + vbox.SetPadded(true) + + hbox := ui.NewHorizontalBox() + hbox.SetPadded(true) + vbox.Append(hbox, false) + + hbox.Append(ui.NewButton("Button"), false) + hbox.Append(ui.NewCheckbox("Checkbox"), false) + + vbox.Append(ui.NewLabel("This is a label. Right now, labels can only span one line."), false) + + vbox.Append(ui.NewHorizontalSeparator(), false) + + group := ui.NewGroup("Entries") + group.SetMargined(true) + vbox.Append(group, true) + + group.SetChild(ui.NewNonWrappingMultilineEntry()) + + entryForm := ui.NewForm() + entryForm.SetPadded(true) + group.SetChild(entryForm) + + entryForm.Append("Entry", ui.NewEntry(), false) + entryForm.Append("Password Entry", ui.NewPasswordEntry(), false) + entryForm.Append("Search Entry", ui.NewSearchEntry(), false) + entryForm.Append("Multiline Entry", ui.NewMultilineEntry(), true) + entryForm.Append("Multiline Entry No Wrap", ui.NewNonWrappingMultilineEntry(), true) + + origbox.Append(vbox, false) + newNode := n.AddNode(title) + newNode.uiBox = vbox + return newNode +}