Add back button to configuration page.

This commit is contained in:
Greg 2019-09-06 10:52:27 -04:00
parent e40e98aa25
commit 7b3d59a581
1 changed files with 21 additions and 1 deletions

View File

@ -326,6 +326,13 @@ func eventLoop() {
Color: black,
Background: gray,
}
backBtn := &Button{
Face: face,
Label: "back",
Alignment: text.End,
Color: black,
Background: gray,
}
anim := &time.Ticker{}
animating := false
@ -422,9 +429,21 @@ func eventLoop() {
cs = flex.Rigid()
al := &layout.Align{Alignment: layout.E}
cs = al.Begin(ops, cs)
dims = saveBtn.Layout(c, q, ops, cs)
btnflx := &layout.Flex{Axis: layout.Horizontal}
btnflx.Init(ops, cs)
cs = btnflx.Rigid()
bc1 := btnflx.End(backBtn.Layout(c, q, ops, cs))
cs = btnflx.Rigid()
bc2 := btnflx.End(saveBtn.Layout(c, q, ops, cs))
dims = btnflx.Layout(bc1, bc2)
c4 := flex.End(al.End(dims))
flex.Layout(c1, c2, c3, c4)
if backBtn.Clicked() {
log(Info, "Back")
storeDirEd.SetText(store.Dir)
w.Invalidate()
page = listPage
}
if saveBtn.Clicked() {
log(Info, "Save")
go func() { // do not block UI thread
@ -434,6 +453,7 @@ func eventLoop() {
saveConf()
reload <- struct{}{}
}()
w.Invalidate()
page = listPage
}
}