Update: If you are a recent version of Captivate (9, 10 or 11) please have a look at :
http://blog.lilybiri.com/1-action-equals-5-toggle-buttons
Intro
In this blog posting To blog or not to blog (scroll to the end of the text please) I offered a tip to create a toggle button to turn on/off audio, playbar etc. This tip works only if a Boolean type system variable is available. Such a variable has in Captivate only two possible values: 1 (= true, yes) and 0 (= false, no).
Yesterday got this question on the user forum: How can I create a toggle button to show/hide a text caption? And I thought offering my answer in a blog post could be useful for other users. Moreover, I remember when starting this blog that it was meant to offer small tips, but now I see that a lot of my postings are not small at all :-)
Variable
Advanced action
Condition is simple: check the value of v_visib
IF |
v_visib is equal to 1 |
THEN |
Hide |
MyTC |
|
Expression |
v_vsib = 1 - v_visib |
|
Assign |
rdcmndGotoFrame with rdinfoCurrentFrame |
If this condition results in a negative answer, this means that the object (here the tekst caption labeled MyTC) is invisible. It has to be made visible (using the Show command). Then you have to change the value of the user variable v_visib to 1. To avoid that the playhead moves on after releasing the pause of the button I rewind the playhead using the system variables rdcmndGotoFrame and rdinfoCurrentFrame.
ELSE |
Show |
MyTC |
|
Expression |
v_vsib = 1 - v_visib |
|
Assign |
rdcmndGotoFrame with rdinfoCurrentFrame |
More ideas
- This toggle is not limited to show/hide captions only of course, you can use it for any object and even for more objects, edit first statement and/or add similar ones.
- You can use a similar script for Enable/Disable too.
- Pity that it is not possible yet to export/import small scripts like this example. However you can add the script to a template. That is a way to be able to reuse the script and not have to create it all the time.