Add back button to configuration page.

This commit is contained in:
Greg 2019-09-06 10:52:27 -04:00
parent e40e98aa25
commit 7b3d59a581

View File

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