Call modal done func on escape key

Fixes #150
This commit is contained in:
Sam Whited 2018-08-03 13:02:59 -05:00
parent 6614b16d90
commit 65c5186a20
1 changed files with 5 additions and 0 deletions

View File

@ -40,6 +40,11 @@ func NewModal() *Modal {
SetButtonBackgroundColor(Styles.PrimitiveBackgroundColor).
SetButtonTextColor(Styles.PrimaryTextColor)
m.form.SetBackgroundColor(Styles.ContrastBackgroundColor).SetBorderPadding(0, 0, 0, 0)
m.form.SetCancelFunc(func() {
if m.done != nil {
m.done(-1, "")
}
})
m.frame = NewFrame(m.form).SetBorders(0, 0, 1, 0, 0, 0)
m.frame.SetBorder(true).
SetBackgroundColor(Styles.ContrastBackgroundColor).