Double-Click to Trigger a Specific Keystroke


#1

Many of my prototypes are highly functional “to a point”. Once that point is reached, I need to refresh the page to get back to a clean state.

I’d like to just double-click somewhere in the prototype and have it trigger an F5 button press to refresh.

To be clear, I have MANY uses for one event to trigger a button press, so please help me understand if that’s possible - the refresh is just a single example.

Thanks.

-g


#2

Under interactions, there’s a dropdown that says “More Events” - the first item in that list would be “OnDoubleClick”.

If you used that and had the action to be open a link to whatever page you’re on, that would accomplish what you’re looking to do. You can also use the following string and the value option to do a refresh via javaScript (for all intents and purposes this does the same thing, but you could copy and paste this event from page to page without having to update the reference to the page):

javascript:void(location.reload());

When you say “somewhere” i’m assuming you mean on a specific widget?


#3

I guess I shouldn’t have used an example…or not this one, anyway.

I have already used this workflow to get my refresh. I’m more interested in the other scenarios - like “double click = CTRL+A”, etc.

Thanks for the follow up…hope there’s a Javascript method to mimic keystrokes.

Cheers.

-g


#4

Sorry, I keyed into what you were describing and didn’t realize the broadness of your title.

You can trigger keypresses via javascript, but it’s a bit more involved - here’s an example:

https://stackoverflow.com/questions/51775289/trigger-enter-keypress-in-vanilla-j

You’d have to create a function by injecting some javascript, and then you could use the same open link command to run the function on double click of something. It’s incredibly hacky… I do it all the time, but definitely not an “easy” thing to do.


#5

OK. Thanks for the response. I don’t actually know where to put any of that (or how to edit it for the different needs), so I’m not going to worry about it!

Cheers.

-g