# addDefaultKeypress

**URL:** <https://forum.juce.com/t/adddefaultkeypress/1314>\
**Category:** General JUCE discussion\
**Created:** [December 23, 2006, 5:29am UTC](https://forum.juce.com/t/adddefaultkeypress/1314 "2006-12-23T05:29:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![testcase](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@testcase](https://forum.juce.com/u/testcase)\
**Post date:** [December 23, 2006, 5:29am UTC](https://forum.juce.com/t/adddefaultkeypress/1314/1 "2006-12-23T05:29:40Z")

</div>

Hi - I am using juce 1.39 on OSX.4

I have set up a ApplicationCommandTarget and am trying to assign default keypresses to the commands. When the keypress involved the command key all works as expected :

result.addDefaultKeypress(T(‘E’), ModifierKeys::commandModifier);

however, when i attempt to assign to a key combo with either alt or control key, it does not respond.

result.addDefaultKeypress(T(‘E’), ModifierKeys::ctrlModifier);

When I print out what I am typing using the keyPressed method for TextEditor I it seems to be key 69 and modifier 2. So I plugged in that keycode and still nothing.

result.addDefaultKeypress(69, ModifierKeys::ctrlModifier);

could anyone help me out on this. i am clearly missing something simple here.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [December 27, 2006, 10:13pm UTC](https://forum.juce.com/t/adddefaultkeypress/1314/2 "2006-12-27T22:13:04Z")

</div>

Sounds like you’re doing the right thing. Could be a mac keyboard mapping glitch, it can be a bit hairy trying to tell the difference between an alt-letter keystroke and the extended character that it would produce when you press it. I’ll check that one out next time I’m on the mac.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 12, 2017, 9:58am UTC](https://forum.juce.com/t/adddefaultkeypress/1314/3 "2017-05-12T09:58:12Z")

</div>


