When you compare widgets in Captivate 5 and widgets in Captivate 4, Captivate 5 doesn’t seem to be all that more powerful. Yes, Captivate Events do open up some interesting possibilities, but none are really earth shattering. The things that give widgets most of their power, (such as being able to access items on the Captivate Slide) are all available in Captivate 4 as well as Captivate 5.
However, if any of you reading this ever set out to make a widget in Captivate 4 that had more than a few options for the Captivate Author to specify, you would probably have found yourself bumping into an infuriatingly simple boundary.
The complexity of your widgets is set by its interface. The interface must fit in the Widget Parameter tab. The Widget Parameters tab is too small.
Seriously, take a look. A StaticWidget could be pretty much anything. But the size of its Widget Parameters tab limited them to medium complexity at best.
Interactive Widgets were better. Yet strangely, I find that most of the Interactive widgets I’ve ever built don’t have really complex interfaces.
Personally, I reckon that Question Widget’s will in general end up having more complicated properties than all other types of widgets put together. But in Captivate 4, they had the smallest properties area of all!
True, you could harness the almighty power of tabs to give yourself some room. However, you can only have so many tabs, and some tabs would end up being more densely populated than others.
On the other side of the scale, what if your widget was simple? What if all you needed for your Widget’s Properties Interface was an input text field? In that case, the interface ended up swimming in room and looked downright unprofessional.
On the humanity! What are we to do?!
Answer: Upgrade. Captivate 5 takes the one thing that was holding widgets back, and lifts it effortlessly away. Yes, widgets are now big enough to decide on their own how big they want their Properties Interface to be.
Cool, How do I do that?
Couldn’t be easier (well I suppose if the program you were using could read your mind so you didn’t have to write any code then that would be even easier than this. But I say this in a practical sense). There are two properties that handle the size of the Properties Dialog, propertiesDialogWidth and propertiesDialogHeight.
What’s that you say? You want your Properties Dialog to be 500 pixels wide by 600 pixels high? Why my good friend, just set your propertiesDialogWidth to 600, and your propertiesDialogHeight to 500. Like so:
1 2 3 4 5 6 7 8 9 10 | package { import widgetfactory.StaticWidget; public class PropertiesDialogWidget extends StaticWidget { public function PropertiesDialogWidget() { propertiesDialogWidth = 500; propertiesDialogHeight = 600; } } } |
This code must go in your constructor function. By the time the widget gets to the enterPropertiesDialog() template method – it’s too late, as the size has already been set. If you publish this widget and open it up in Captivate 5, the Properties Dialog will look like this (minus the outspoken comment of course).
That’s pretty much it. I have now run out of practical things to tell you.
OH! If you want to optimise your code by one line, and make it look like you understand how Object Oriented Programming works, you can get the same result as above by writing this instead.
1 2 3 4 5 6 7 8 9 10 11 | package { import widgetfactory.StaticWidget; public class PropertiesDialogWidget extends StaticWidget { public function PropertiesDialogWidget() { //super(Properties dialog width , Properties dialog height); super(500,600); } } } |
This does exactly the same thing, the first parameter takes the width, and the second the height. It’s no more or less powerful, it just looks cooler. Technically what’s going on here is that we’re sending our desired width and height for the Properties Dialog into the constructor function for the StaticWidget class (That be the class we’re extending. Known as the Super Class).
Anything else?
Well… here are a couple of tips for you:
- The Properties Dialog width and height will default to (almost) the same size as it was for that type of widget in Captivate 4.
- If you specify a Properties Dialog size that is different to the stage size of your flash file, then be warned, the widget WILL be resized. Now there is more than one way to resize a swf. WidgetFactory sets the resize mode for the stage to NO_SCALE. Which means that when we make the window larger we will see more of the stage, and when we make the window smaller we’ll see less of it. Outside of WidgetFactory, the typical method of resizing the stage would stretch it to the new size, but this results in the contents of the swf being distorted. For more information on stage scale stuff, see the ActionScript Live docs.
- If your widget doesn’t need a Properties Interface, you can make impossible for the Captivate Author to open the Properties Dialog by setting its width and height to 0, or by calling disablePropertiesDialog() in your constructor function. Note: This will not stop the Widget Parameters tab from appearing in Captivate 4.
End of an Error
Well that’s the top 5 features in this release of WidgetFactory. You now have some serious weapons at your disposal for your next widget. But wait! There’s more! Starting from next week I’ll be blogging about… Something else. Haven’t quite decided what yet as there are so many things to blog about. So I thought rather than being selfish and writing about whatever I want, I’d let you guys decide.
Got something pretty specific you’d like to learn? Perhaps some feature of widgets that is making itself hard to grasp? Let me know and I’ll see what I can do (that is of course if I’m not totally flummoxed by it too. Which is more than likely).
Happy Widget(t)ing!



