Example #1
0
func (a *MyApp) HandleEvent(ev topsl.Event) bool {
	if a.panel != nil {
		if a.panel.HandleEvent(ev) {
			return true
		}

		switch ev := ev.(type) {
		case *topsl.KeyEvent:
			switch ev.Ch {
			case 0:
			case 'Q', 'q':
				topsl.AppFini()
				return true
			case 'S', 's':
				a.model.hide = false
				a.updateKeys()
				return true
			case 'H', 'h':
				a.model.hide = true
				a.updateKeys()
				return true
			case 'E', 'e':
				a.model.enab = true
				a.updateKeys()
				return true
			case 'D', 'd':
				a.model.enab = false
				a.updateKeys()
				return true
			}
		}
	}
	return false
}
Example #2
0
func (a *MyApp) HandleEvent(ev topsl.Event) bool {
	if a.panel != nil {
		if a.panel.HandleEvent(ev) {
			return true
		}

		switch ev := ev.(type) {
		case *topsl.KeyEvent:
			switch ev.Ch {
			case 0:
			case 'Q', 'q':
				topsl.AppFini()
				return true
			}
		}
	}
	return false
}
Example #3
0
func (a *App) Quit() {
	topsl.AppFini()
	os.Exit(0)
}
Example #4
0
func (a *App) Die(s string) {
	topsl.AppFini()
	fmt.Printf("Failure: %s", s)
	os.Exit(1)
}