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

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