Using "Shift + Click" or "Ctrl + Click" in Triggers

Is there a way to require the user to hold down the Shift key or Ctrl key while clicking on something in Articulate Storyline?  I'm trying to create a simulation of selecting multiple items in a list.

I thought of using the "User Presses a Key" trigger to adjust a variable indicating whether or not Shift/Ctrl is held down. It looks like you can only use Shift/Ctrl in combination with other keys in the Trigger Wizard, however.   Any other ideas?

19 Replies
Tim Shelton

No, I dont think you can get this kind of function to work. CTRL or SHIFT clicking uses 2 functions and storyline doesnt track clicking as a button press. Also there is a good reason to avoid ever using button triggers using these keys as they have functions in every browser which will nullify your interactions. 

Gary Collins

Well I sort of have this working with javascript but not completely.

I created a button with a normal state and 'ctrl_selected' state.

I also have a variable called 'keypress' initially set to 'false'

I add a trigger to the button to change the state to 'ctrl_selected' if keypress equals true.

Then I add a slide trigger that executes javascript when the timeline starts.

JAVASCRIPT

var player = GetPlayer();

player.addEventListener("keydown", function(event) {
if (event.ctrlKey )
player.SetVar("keypress",true);
});

player.addEventListener("keyup", function(event) {
if (event.ctrlKey )
player.SetVar("keypress",false);
});

This will detect the ctrl key down and change the variable to true so that when the user clicks the button the state will change.

I also want to be able to detect the keyup event so that when they release the ctrl key it will return back to false otherwise they can click more buttons without holding the ctrl key because the variable will be true.

The problem I am having is the keyup function is not being detected.

I am not a javascript expert but this is what I came up with so far when googling javascript.

I will keep trying but hopefully someone else can help out with this to get the keyup event to work.

View online here.

 

Ashley Terwilliger

Hi Christodoulos,

Also if you don't have a web server to upload the content to, you could look at using Tempshare.articulate.com which is a free testing platform and the link will stay live for 10 days. Also, you could look at using Amazon S3 as a hosting platform as it does have generous usage limits at a low cost. This article described here how to upload and use Amazon S3. 

Marko Stojkovski
Gary Collins

Carol,

I have updated the file so you can now select and deselect the items.

You can view it here.

And download the source here.

Hello. This is kinda old topic, but I have found it searching through the internet. I need the CTRL function in a software simulation I am currently working on, so these two links are not working. I would really like to see the solution. Thanks

Marko Stojkovski

Hello, me again. Just to let you know that I have finally found a solution for this problem. I am not sure did the quoted links in my post above had the same solution, but here are the links to the solution I came up with:
LinkedIn Article: https://www.linkedin.com/pulse/ctrl-click-select-many-shift-trigger-software-marko-stojkovski?published=t
My webpage post: http://www.enaspot.com/?portfolio=ctrl-click-trigger-select-many-in-software-simulation