# How to make onKeyDown specific to one key?

**URL:** <https://forum.inductiveautomation.com/t/how-to-make-onkeydown-specific-to-one-key/107200>\
**Category:** Ignition\
**Tags:** ignition81, python, scripting, perspective\
**Created:** [June 9, 2025, 10:46pm UTC](https://forum.inductiveautomation.com/t/how-to-make-onkeydown-specific-to-one-key/107200 "2025-06-09T22:46:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![danny.lazaro](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/danny.lazaro/32/79188_2.png) [@danny.lazaro](https://forum.inductiveautomation.com/u/danny.lazaro)\
**Post date:** [June 9, 2025, 10:46pm UTC](https://forum.inductiveautomation.com/t/how-to-make-onkeydown-specific-to-one-key/107200/1 "2025-06-09T22:46:12Z")

</div>

Hi,

I want to configure an Request print action based on an onKeyDown event. However, I only want it to work for an specific key (i.e. Ctrl or Alt) to let the user be able to write on that component. The component I am working on is a Power Chart, and there are some settings like name assignment and other functionalities that require text input from the user.

I know the event has properties I can access from a Script action (event.altKey) but I dont know how that event action script can trigger the Request Print.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/3/e3f00361e59129c007e16dd4f87c7b7e4f3ee26a.png)

Thanks,  
Danny

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 9, 2025, 10:47pm UTC](https://forum.inductiveautomation.com/t/how-to-make-onkeydown-specific-to-one-key/107200/2 "2025-06-09T22:47:50Z")

</div>

You asked this question just a little while ago over here:

> [@OnKeyDown event to trigger RequestPrint for PowerChart component not working](https://forum.inductiveautomation.com/t/onkeydown-event-to-trigger-requestprint-for-powerchart-component-not-working/107197):
>
> Hi, I am working with a Power Chart component. I wish there was a sliding Trace I want two things: Print the view using component action. X Trace to have values at the time of printing. X Trace only shows values when your mouse cursor is hovering over the chart. Can't print using a button because of this. So, I have configured an onKeyDown event to trigger the RequestPrint action for the Power Chart. This way, whenever you have placed your mouse over the instant you want the X Trac…

Multiple posts are against this [forum's rules](https://forum.inductiveautomation.com/faq).
