Issue with "If key pressed"


#1

Hi,
I have a condition that checks if the shift key is pressed.
If it is, I want to multi select some objects
otherwise selecting an object should deselect the others.
I placed all the objects in a group, so I can easily deselect the group.

The problem is that once the shift key is pressed, the condition always evaluates to yes, even if the key is no longer pressed.

Any idea why this is happening?

image


#2

Interesting… I tested this with a few other keys just to be sure it wasn’t something due to the Shift key being a modifier-key, and I get the same results. It sure seems like this should work, so I would call it a bug. Maybe some buffer isn’t getting cleared? I think I’ll report this to Axure.

Here is a workaround. It has been the way I use key+click combos in the past, and I confirmed it works in current version of RP 10. It also works with key combinations, like Shift+Ctrl+A, and you can include additional cases to support other key+“interaction event” features, like holding Ctrl key and dragging something.

For the page (no widgets selected),
image
…this example uses the default OnLoadVariable, but you can use any global variable, text value of any widget, hidden or shown, selection state of a widget, etc.

Then, for your widget,
image


#3

Brilliant! Thanks you.


#4

We were able to investigate this behavior and found that the “key pressed” condition registers the last key that is pressed and saves this status until another key is pressed. So in this first example, if you pressed a different key other than shift, the interaction will then use the “Else if” statement.

This behavior does seem unexpected to me as it does make sense that this interaction and condition should only carry out while both actions are occurring simultaneously. I’ve gone ahead and filed this bug for our teams to investigate this behavior.

Thanks @rviard for bringing this up and @mbc66 for that workaround!


#5

Thanks @ BenHoang_Axure. That was also my assumption, it should only be recognized while the key is down. Thanks for bringing this up to the dev team.


closed #6

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.