# Key callback behaviour

**URL:** <https://discourse.glfw.org/t/key-callback-behaviour/266>\
**Category:** support\
**Created:** [October 13, 2011, 8:46pm UTC](https://discourse.glfw.org/t/key-callback-behaviour/266 "2011-10-13T20:46:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [October 13, 2011, 8:46pm UTC](https://discourse.glfw.org/t/key-callback-behaviour/266/1 "2011-10-13T20:46:22Z")

</div>

**[o-san](https://sourceforge.net/u/o-san/)** wrote on [Thursday, October 13, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/dc6b9b03/#7282):

I’m having trouble to detect the escape key using a callback:

glfwSetKeyCallback(keyCallback);  
void GLFWCALL keyCallback(int key, int action) …

The callback is never triggered when escape is pressed. It detects other keys  
such as the arrow keys and space. Any help appreciated.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [October 13, 2011, 9:11pm UTC](https://discourse.glfw.org/t/key-callback-behaviour/266/2 "2011-10-13T21:11:39Z")

</div>

**[o-san](https://sourceforge.net/u/o-san/)** wrote on [Thursday, October 13, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/dc6b9b03/#5b80):

Well, I found out that if I press shift+escape the callback is triggered, very  
strange. I need to check my program on another computer…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [October 14, 2011, 12:11am UTC](https://discourse.glfw.org/t/key-callback-behaviour/266/3 "2011-10-14T00:11:32Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Friday, October 14, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/dc6b9b03/#6d49):

What version of which OS is this on? What version of GLFW are you using?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [October 14, 2011, 6:52am UTC](https://discourse.glfw.org/t/key-callback-behaviour/266/4 "2011-10-14T06:52:52Z")

</div>

**[o-san](https://sourceforge.net/u/o-san/)** wrote on [Friday, October 14, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/dc6b9b03/#69f6):

I’m using windows7 and glfw2.7… Strangest thing. Now it works, haven’t done a  
thing. :-/
