Mouse/Keyboard Related

This page explains how to use command variables that deal with how the mouse interacts with Captivate.

This is not to be confused with command variables that allow you to call actions on mouse events. The help for those variables can be found under the events and actions page.

xcmndSetCursor

Parameters

  1. Slide object name (or @syntax query)
  2. CSS mouse cursor id (Click here to see a list of valid ids)

Features

  • Uses @syntax

Description

Note: Not all mouse cursor ids are supported on all browsers. Also, mobile devices do not show any cursor images, therefore the effects of this command variable will not be visible on a mobile browser. 

By default, Captivate displays the normal mouse pointer over shape buttons. If you had a shape button named Shape_Button_1 and you wanted a hand cursor to appear when rolling over it, you could achieve that with the following code.

Assign | xcmndSetCursor with Shape_Button_1, pointer

This need not only apply for buttons however. If you have four objects on slide called: Caption_1, Caption_2Caption_Bob, and Shape_1; the following code will replace the cursor with a loading animation when you roll over Caption_1, Caption_2, and Caption_Bob but NOT Shape_1.

Assign | xcmndSetCursor with Caption_@, wait

PRO TIP: If when you rollover an object you want to hide the mouse cursor completely, you can use the none CSS mouse cursor id. 

Assign | xcmndSetCursor with MyImage, none

xcmndDisableMouseEvents

​Features

  • Uses @syntax
  • Uses comma delimited lists

Description

Assigning xcmndDisableMouseEvents with the name of a slide object will make the mouse ignore that object completely. It will not register mouse down, mouse up, rollover, or rollout. This allows any slide objects underneath that object to respond to mouse input. This is extremely useful when you start building advanced interactions.

The code below will disable mouse events any object called Caption_1 (even if that object is not on the current slide).

Assign | xcmndDisableMouseEvents with Caption_1

You can give xcmndDisableMouseEvents a list of objects to disable by separating their names with commas.

The code below will disable Caption_1, Caption_2, and Caption_3, through a single assign action.

Assign | xcmndDisableMouseEvents with Caption_1, Caption_2, Caption_3

You can use an @syntax query to select a group of objects to disable.

If you have four objects on slide called: Caption_1, Caption_2Caption_Bob, and Shape_1; the following code will disable Caption_1, Caption_2, and Caption_Bob but NOT Shape_1.

Assign | xcmndDisableMouseEvents with Caption_@

You can also use a mixture of @sytax and comma delimited lists. Using the slide example above, the following code would disable all four objects, including Shape_1

Assign | xcmndDisableMouseEvents with Caption_@, Shape_1

Note: @syntax will only select matching objects on the current slide. It will not disable all matching objects throughout the project.

xcmndEnableMouseEvents

​Features

  • Uses @syntax
  • Uses comma delimited lists

Description

Assigning xcmndEnableMouseEvents with the name of a slide object cause that object to hear mouse events again. This of course only applies to objects that have previously been disabled with xcmndDisableMouseEvents.

The usage of this variable is exactly the same as xcmndDisableMouseEvents.

xcmndPreventTabOut

​Features

  • Uses @syntax
  • Uses comma delimited lists

Description

The TAB key has a special use in browsers and for computers in general. It is an accessibility feature that allows people who are unable to make use of the mouse to be able to move keyboard focus to different items on screen. As such, in an exported Captivate project, whenever you press the TAB key, the browser will try and move keyboard focus to the next available object. However, sometimes this can lead to unexpected behavior.

For example, let's say you're building a software simulation and you include a text entry box called MyTextEntryBox. After entering text into the text entry box, you want the learner to press the TAB key. To detect them doing so, you go to the text entry boxes preferences, open the Actions tab, and under the shortcut section add the TAB key.

Most would expect this to mean that when the learner presses the TAB key the MyTextEntryBox will report success. However, in practice this doesn't happen. When pressing the TAB key, the browser will first try to shift keyboard focus THEN attempt to execute the text entry boxes success action. However, by that point it is too late.

This is where xcmndPreventTabOut comes it. When assigning it the name of a text entry box...

Assign | xcmndPreventTabOut with MyTextEntryBox

CpExtra will prevent the default TAB key behavior from happening when that object has keyboard focus. So next time MyTextEntryBox is selected and you press TAB, the keyboard focus will remain in that text entry box, thereby allowing Captivate to continue to report the MyTextEntryBox's success criteria.

Note: Only one text entry box on any one slide can be enabled with xcmndPreventTabOut's special behavior.

xcmndAllowTabOut

​Features

  • Uses @syntax
  • Uses comma delimited lists

Description

Assigning xcmndAllowTabOut with the name of a slide object cause that object to respond to the TAB key again. This of course only applies to objects that have previously been disabled with xcmndPeventTabOut.

The usage of this variable is exactly the same as xcmndPreventTabOut.

IF YOU LIKE WHAT YOU'VE READ ABOVE, THERE'S PLENTY MORE!

Join more than 2500 other Adobe Captivate users just like yourself and receive regular troubleshooting tips, illustrated tutorials, technical information, and creative solutions to real-world e-learning development issues. (See an example here.) Click the button below to join our community.  It's completely FREE!