From 03685f9a33af71add9ea8099917b214606d73c24 Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Sun, 29 Dec 2019 22:06:38 +0100 Subject: [PATCH] Changed order of apply/cancel in settings view. Escape now exits settings directly. --- cmd/krampus19/changesettings.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cmd/krampus19/changesettings.go b/cmd/krampus19/changesettings.go index ad52b5d..8ce7cb2 100644 --- a/cmd/krampus19/changesettings.go +++ b/cmd/krampus19/changesettings.go @@ -280,6 +280,7 @@ func (s *changeSettings) Enter(ctx *Context) error { ) buttons := &alui.StackPanel{Orientation: alui.OrientationHorizontal} buttons.AddChild( + newWideButton("Cancel", func() { s.ctx.Navigation.ShowMainMenu() }), newWideButton("Apply", func() { var controls = controls{MoveLeft: keyLeft.Key, MoveUp: keyUp.Key, MoveRight: keyRight.Key, MoveDown: keyDown.Key} var video = video{Windowed: windowed.Selected, DisplayMode: displayMode.Mode()} @@ -293,11 +294,22 @@ func (s *changeSettings) Enter(ctx *Context) error { s.ctx.Navigation.ShowMainMenu() }), - newWideButton("Cancel", func() { s.ctx.Navigation.ShowMainMenu() }), ) s.AddChild(alui.Center(buttons)) return nil } +func (s *changeSettings) Handle(e allg5.Event) { + s.Column.Handle(e) + + switch e := e.(type) { + case *allg5.KeyDownEvent: + switch e.KeyCode { + case allg5.KeyEscape: + s.ctx.Navigation.ShowMainMenu() + } + } +} + func (s *changeSettings) Leave() { }