start playing with buttons

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-07 20:11:41 -07:00
parent b4e1c326d5
commit 6c5af117f2
3 changed files with 12 additions and 31 deletions

View File

@ -23,6 +23,7 @@
"debug": false, "debug": false,
"envKey1": "${NotExist|defValue}", "envKey1": "${NotExist|defValue}",
"height": 600, "height": 600,
"width": 800,
"hostname": "localhost", "hostname": "localhost",
"map1": { "map1": {
"key1": { "key1": {
@ -32,6 +33,5 @@
"key2": "val20" "key2": "val20"
}, },
"name": "app2", "name": "app2",
"shell": "${SHELL}", "shell": "${SHELL}"
"width": 400
} }

View File

@ -1,27 +0,0 @@
name: app2
debug: false
baseKey: value2
shell: ${SHELL}
envKey1: ${NotExist|defValue}
cloud:
v000185.testing.com.customers.wprod.wit.com:
port: 3333
proto: tcp
jcarr:
port: 3333
proto: tcp
foo.bar:
port: 3333
proto: tcp
map1:
key1:
jwc1: jcarr1
jwc2: jcarr2
key2: val20
arr1:
- lo
- wifi0
- docker0

12
gui.go
View File

@ -10,22 +10,29 @@ import "github.com/gookit/config"
import "github.com/andlabs/ui" import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest" import _ "github.com/andlabs/ui/winmanifest"
// import "github.com/davecgh/go-spew/spew" import "github.com/davecgh/go-spew/spew"
var mainwin *ui.Window var mainwin *ui.Window
var maintab *ui.Tab var maintab *ui.Tab
var tabcount int var tabcount int
func buttonClick(button *ui.Button) {
log.Println("hostname =", config.String("hostname"), button)
spew.Dump(button)
}
func hostnameButton(hostname string) ui.Control { func hostnameButton(hostname string) ui.Control {
tmpbox := ui.NewHorizontalBox() tmpbox := ui.NewHorizontalBox()
tmpbox.SetPadded(true) tmpbox.SetPadded(true)
tmpButton := ui.NewButton(hostname) tmpButton := ui.NewButton(hostname)
tmpbox.Append(tmpButton, false) tmpbox.Append(tmpButton, false)
tmpButton.OnClicked(buttonClick)
/*
tmpButton.OnClicked(func(*ui.Button) { tmpButton.OnClicked(func(*ui.Button) {
log.Println("hostname =", config.String("hostname"), tmpButton) log.Println("hostname =", config.String("hostname"), tmpButton)
}) })
*/
return tmpbox return tmpbox
} }
@ -113,6 +120,7 @@ func makeNumbersPage() ui.Control {
vbox.Append(spinbox, false) vbox.Append(spinbox, false)
vbox.Append(slider, false) vbox.Append(slider, false)
vbox.Append(pbar, false) vbox.Append(pbar, false)
vbox.Append(hostnameButton("jcarrtest"), false)
ip := ui.NewProgressBar() ip := ui.NewProgressBar()
ip.SetValue(-1) ip.SetValue(-1)