This topic explains how to use CpExtra preference variables to change CpExtra's behaviour.
- Name of Interactive Object
- Name of Criteria - success (default), failure, onfocuslost
This preference variable is like a one shot xcmndCallActionOn which is called no matter what right at the start of the Captivate Project.
This is useful when using features such as Self-Paced Learning or LMS Bookmarking which may skip over the first slide in the course and jump directly to the slide the learner was viewing in their last session. xprefInitAction allows you to ensure an action will be run before anything is seen by the learner. This may involve hiding some objects using #syntax and xcmndShow, or to add event listeners with #syntax and xcmndAddEventListener.
At any rate, the variable will need these two parameters.
Of course, CpExtra can only call this action right at the start of the project, if it is loaded headlessly. Otherwise, when loaded as a widget, it will be called as soon as the widget has been loaded. Though this kind of defeats the purpose of the variable to begin with.
Expected value: Seconds
Default value: 0.5
Very occasionally you come across the occasion where you want to detect if the user clicked on an object one time or two times.
For example, lets say you were recreating a Windows desktop. You want to detect if the user clicked once on a desktop shortcut (which would select the shortcut) or whether they double clicked it (which would open the program).
This can be quite tricky to detect, as a double click is just two single clicks that are very close to each other. Therefore a click event will ALWAYS fire before a double click event. However, CpExtra provides a way to get around this.
If you have used xcmndAddEventListener to listen for a click AND a double click event, then when the user clicks on that slide object CpExtra will not immediately fire the click event. Instead, it will wait a certain amount of time to see if the user will click again. If they DO click again, it will fire the double click event instead of the click event. If they DON'T click again, it will fire the click event.
But how much time should it wait?
That's a decent question. If you're making a course for a receptionist with good computer skills, they'd notice if there's a half second pause between them single clicking an object and there being some feedback for that. On the other hand, if you're making a course for the residents of an old age home, then your target audience would very likely lack the muscle memory to perform a double click in one second, let alone half.
Therefore xprefDoubleClickDelay allows you to define how many seconds this delay period should last. Assigning it with 1, will make it last one second. Assigning it with 2, will make it last two seconds.
For a standard target audience, you should probably leave it at its default of 0.5 (half a second).
Expected value: Boolean (yes/no, true/false, 1/0)
Default value: True
In CpExtra there is a lot of potential for... pilot error. There are many times where you have to type out the name of a slide object and a certain percentage of the time we're going to write that name incorrectly.
Fortunately, when CpExtra encounters misspellings or the like, it spits up a helpful error message to let you know when something. These error messages also give you suggestions on how you might fix the problem.
However, when you finalize your course and send it out into the wild, there is always the possibility that there is another bug lying under the hood somewhere. If a user stumbles upon that error, you'd probably rather he not see a big alert box appear saying: CpExtra Encountered Error CV012!
Therefore, by setting this preference variable to false, you can ensure that no such messages will appear.