From 3a40ecad4c637257196b551cea79072ea8de3437 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 6 May 2019 16:43:54 -0700 Subject: [PATCH] trim out all the garbage from the example Signed-off-by: Jeff Carr --- gui-example1/Makefile | 2 + gui-example1/main.go | 105 ------------------------------------------ 2 files changed, 2 insertions(+), 105 deletions(-) create mode 100644 gui-example1/Makefile diff --git a/gui-example1/Makefile b/gui-example1/Makefile new file mode 100644 index 0000000..e07773d --- /dev/null +++ b/gui-example1/Makefile @@ -0,0 +1,2 @@ +run: + go run *.go diff --git a/gui-example1/main.go b/gui-example1/main.go index c7d1c9b..33e625f 100644 --- a/gui-example1/main.go +++ b/gui-example1/main.go @@ -4,25 +4,6 @@ import "github.com/andlabs/ui" var mainwin *ui.Window -func makeGroupEntries() ui.Control { - group := ui.NewGroup("Entries") - group.SetMargined(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) - - return group -} - func makeNumbersPage() ui.Control { hbox := ui.NewHorizontalBox() hbox.SetPadded(true) @@ -84,92 +65,6 @@ func makeNumbersPage() ui.Control { return hbox } -func makeDataChoosersPage() ui.Control { - hbox := ui.NewHorizontalBox() - hbox.SetPadded(true) - - vbox := ui.NewVerticalBox() - vbox.SetPadded(true) - hbox.Append(vbox, false) - - vbox.Append(ui.NewDatePicker(), false) - vbox.Append(ui.NewTimePicker(), false) - vbox.Append(ui.NewDateTimePicker(), false) - vbox.Append(ui.NewFontButton(), false) - vbox.Append(ui.NewColorButton(), false) - - hbox.Append(ui.NewVerticalSeparator(), false) - - vbox = ui.NewVerticalBox() - vbox.SetPadded(true) - hbox.Append(vbox, true) - - grid := ui.NewGrid() - grid.SetPadded(true) - vbox.Append(grid, false) - - button := ui.NewButton("Open File") - entry := ui.NewEntry() - entry.SetReadOnly(true) - button.OnClicked(func(*ui.Button) { - filename := ui.OpenFile(mainwin) - if filename == "" { - filename = "(cancelled)" - } - entry.SetText(filename) - }) - grid.Append(button, - 0, 0, 1, 1, - false, ui.AlignFill, false, ui.AlignFill) - grid.Append(entry, - 1, 0, 1, 1, - true, ui.AlignFill, false, ui.AlignFill) - - button = ui.NewButton("Save File") - entry2 := ui.NewEntry() - entry2.SetReadOnly(true) - button.OnClicked(func(*ui.Button) { - filename := ui.SaveFile(mainwin) - if filename == "" { - filename = "(cancelled)" - } - entry2.SetText(filename) - }) - grid.Append(button, - 0, 1, 1, 1, - false, ui.AlignFill, false, ui.AlignFill) - grid.Append(entry2, - 1, 1, 1, 1, - true, ui.AlignFill, false, ui.AlignFill) - - msggrid := ui.NewGrid() - msggrid.SetPadded(true) - grid.Append(msggrid, - 0, 2, 2, 1, - false, ui.AlignCenter, false, ui.AlignStart) - - button = ui.NewButton("Message Box") - button.OnClicked(func(*ui.Button) { - ui.MsgBox(mainwin, - "This is a normal message box.", - "More detailed information can be shown here.") - }) - msggrid.Append(button, - 0, 0, 1, 1, - false, ui.AlignFill, false, ui.AlignFill) - button = ui.NewButton("Error Box") - button.OnClicked(func(*ui.Button) { - ui.MsgBoxError(mainwin, - "This message box describes an error.", - "More detailed information can be shown here.") - }) - msggrid.Append(button, - 1, 0, 1, 1, - false, ui.AlignFill, false, ui.AlignFill) - - return hbox -} - func setupUI() { mainwin = ui.NewWindow("gui-example1", 300, 200, false) mainwin.OnClosing(func(*ui.Window) bool {