Intro
Finally got to writing this third part about using the included widgets to create custom question slides, in this case Fill-in-the-Blank questions with dropdown lists and a Matching question (but without the dragging possibilities of the default Matching question slide - functionality which is only possible with widgets from InfoSemantics).
For dropdown lists, perhaps you'll expect me to use the Dropdown or Combobox widgets, which are very similar in use. But since months, my friend (AS and JS wizard) Jim Leichliter warned me not to use those widgets in production because of serious memory leaks. So, waiting for those issues to be solved, I discovered another widget: Listbox which is not suffering from the same illness. Although the layout possibilities are limited for this widget, it has some nice features which I will try to explain in this post. And we will be ecological again, by reusing variables. This widget is not enhanced, it is not possible to control the choice, the associated variables by advanced actions. That is the reason why Retaking is not possible.
Example
Play with this small SWF to see a worked out example with 3 question slides: two Fill-in-the-Blank and one matching question. Each question slide has one Listbox widget, used in a different way:
- to enter 2 answers at once (use CTRL to select the second item) - I provided partial scoring, 5points for each correct answer
- to enter 1 answer, score 5 points
- same widget is used for 2 choices and multiple answers possible - only correct/incorrect possible with a score of 15points
Listbox widget - functionalities
The Properties dialog box has not a lot of configuration possibilities as you can see: in the upper field you can type the items for the rolldown list, and the second field is meant for variables. No formatting whatsoever: not for the fonts, not for the colors of fill/border. And as for most widgets, no Help available.
What is the meaning of those variables? After some exploration, can offer you these tips:
- Similar to other widgets, you have to create those user variables separately (see Using Captivate Widgets - some tips)
- The variables will store the chosen answer in the sequence they are chosen; you only need variables for the possible correct answers; in the example two answers were correct, so I defined two variables; the first answer chosen by the user will be stored in v_one, the second in v_two.
- Contrary to other widgets, you can have spaces after the commas for the field with items, the space will be considered however as a first character; for the variables avoid those spaces
- To make the font bigger, increase the size of the widget. It is a bit of trial and error to find a font that corresponds with other text. Do not worry about keeping the width/height ratio, the font will always keep a correct aspect. The widget bounding box is a lot bigger than the dropdown list itself, as you can see on this screenshot. Once I figured out the proper size, I used the size mentioned in the Transform accordion to change all the widgets to the same size.
Reusing variables
Eating my own dog food (see Be a Captivate Ecologist: reuse Variables) I defined these user variables:
- v_one, v_two, v_three to be (re-)used as associated variables in the Listbox Widgets on the question slides (used 2 on first questin, 1 on the second and 3 on the last)
- v_correct1, v_correct2, v_correct3 which will get the correct values on entering question slides 1/2 or based on choice for question slide 3; those are reused variables as well
- v_q1, v_q2, v_q3 are not reused, but will get the string 'Correct', 'Partially correct' or 'Wrong' for the question slides depending on the user's answer
- v_region is used on the third question slide, to store the choice for 'Flanders' (value = 1) or 'Wallonia' (value = 2)
- v_score, v_percent will store the score and percentage to be showed on the score slide.
Advanced actions
First Question Slide:
EnterQuest1: standard action triggered on entering the slide
will assign the correct answers to v_correct1 and v_correct2. This is not necessary for the second question slide where I used a simple action (in the Action accordion) to assign the correct answer to v_correct1. On question slide 3 the assignment will be done with the actions triggered by the click boxes over 'Flanders' and 'Wallonia'.
BtSubmit1: conditional action triggered by the button Submit
This action has 4 decisions:
- Failure: is a mimicked standard action, will always be true but overridden for partial or correct answers by the subsequent decisions (see screenshot in Gallery); it will show the Next button (initially invisible), Failure1 Text Caption and puts 'Wrong' in the user variable v_q1;
- Partial: checks if at least one answer is correct, with an OR combination (see screenshot); it shows Next button, Partial Text Caption, hides the Failure1 caption, adds 5 points to the score and puts 'Partially correct' in the user variable v_q1. If the answer is totally correct, this condition is also true and statements will be executed, but part of them will be overridden by one of the Success decisions. The Next button that was made visible by the Failure statements, will remain visible.
- Success1: because the correct answers have no imposed sequence, we need two success decisions (second has v_one and v_two interchanged). This action (see screenshot) checks if both answers are correct, shows the Correct Text Caption, hides the Partial Text Caption, adds another 5points to the score (combined with the previous 5 = 10 points), and puts 'Correct' in the user variable v_q1.
- Success2: similar to previous, just switch v_one and v_two in the condition.
Second Question Slide:
This slide has a simple action on Enter to assign the correct value to v_correct1.
BtSubmit2: conditional advanced action triggered by the button Submit
This action has 1 THEN - ELSE decision, checks if v_one is equal to v_correct1; think you can figure out what it is doing, similar to the previous Submit action.
Third Question Slide:
On this slide, the texts Flanders and Wallonia are covered up with click boxes CB_Flanders and CB_Wallonia. Both trigger a standard advanced action (with same name, which is possible if you have labeled the click boxes first). You have a screenshot of the Flanders action in the Gallery, it is really self-explanatory: assigns the correct values to v_one, v_two, v_three variables, populates v_region, hides the text caption Wallonia and makes the initially invisible Widget visible. For the Wallonia action, an extra statement applies a custom motion effect.
BtSubmit3: conditional advanced action triggered by the button Submit.
This action has 7 decisions:
- Failure: is a mimicked standard action, totally similar to the one in btSubmit3; it will be overridden by one of the subsequent decisions if the answer is totally correct
- till 7. Success1..... Success6: for the same reason I needed to have 2 Success decisions for BtSubmit1, since now 3 items are correct there are 1x2x3 = 6 possible combinations, hence 6 decisions. One of them, Success4 has a screenshot in the Gallery. It is similar to the Success decisions for the first question slide.
Score slide
EnterScore: triggered on entering the slide, to calculate the percentage (see screenshot).
Conclusion
Sincerely regret that I couldn't do a comparison with the dropdown and combobox widgets because ot the issues I mentioned. They have better formatting options, but no possibility to select more than one item as I could use with the Listbox widget. And I also regret not to be able to control the content of the variables with an advanced action.
Hoping that this new example of reusing variables and of the way conditional actions are executed linearly are useful for someone.