Add custom event handling

This commit is contained in:
gizak
2015-10-13 12:45:03 -04:00
parent 86950762b0
commit 2e6591a15e
5 changed files with 34 additions and 0 deletions

View File

@@ -40,8 +40,13 @@ func main() {
}
})
termui.Handle(("/usr"), func(e termui.Event) {
debug.Logf("->%v\n", e)
})
termui.Handle("/timer/1s", func(e termui.Event) {
t := e.Data.(termui.EvtTimer)
termui.SendCustomEvt("/usr/t", t.Count)
if t.Count%2 == 0 {
b.BorderLabel = "[HELLO](fg-red,bg-green) [WORLD](fg-blue,bg-white)"
@@ -52,5 +57,6 @@ func main() {
termui.Render(b)
})
termui.Loop()
}