Multiple Key Up Events


#1

I regularly work with keyboard inputs for my prototypes. I’m having an issue where i want to be able to hold one key, hold down another key, then release them both and have both of their key up events play out.

What happens is only the key up event of the second key plays out. You can see an example in the attached file. Try holding A, then B, then let go of both.

I could manually have the A Key Up event play when letting go of B, but I’d like to find a cleaner way to handle this. Any suggestions?

Thank you!

key_up_down.rp (44.3 KB)


#2

You’re close. Just a little tweak and simplification of the logic and it works great. I’m actually surprised it works at all with the Key Down and Key Up events placed on the button widgets. Usually, the Page Key Down event is required, and that should be more reliable, especially for the key releases, and/or if you have any “focusable” widgets on the page. See Page 2 of this updated file:

key_up_down.rp (53.6 KB)

So, I moved your code to the Page Key Down and Page Key Up events. For the latter, this gives the ability to make a case with a condition of “If key pressed equals A or key pressed equals B” (and technically, for this example, no case is required, as your ellipses are only shown while a key is held down and releasing any key should result in both ellipses being hidden.)

I like the ability to detect combo key presses, so I added in a “grouping” widget to show when both keys A and B are held down, just for demonstration purposes.


Unable to build a condition to know when user press alt+K in Axure 8
#3

This is great! It’s definitely a step in the direction of figuring this out. The tricky part is I was hoping to be able to make this work with widgets in a Library, which can’t have Page Key Down events on them as far as I can tell.