lxn / walk

A Windows GUI toolkit for the Go Programming Language
Other
6.83k stars 884 forks source link

can't bind function to walk.KeyEscape #668

Open xphlawlessx opened 4 years ago

xphlawlessx commented 4 years ago

Making Declarative UI, this works with other keys (KeyUp,KeyDown,KeyReturn,KeyF6,KeyF7) but not with escape. Tried binding to mainwindow and lineentry, neither works for escape. on Windows 10

OnKeyDown: func(key walk.Key) {
            if key == walk.KeyEscape {
                fmt.Println("!")
            }
        },
xphlawlessx commented 4 years ago

fmt.PrintLn(key) prints names for other keys but not escape

xphlawlessx commented 4 years ago

From reading source code / books , I think I've found the reason, the escape event is tied to the close() event for modal windows , so to get this behaviour , I think I'd need to open a pop up window instead, if someone can confirm this , I'll close the issue :)