Ta dum! I give you progress bars!! [smile]
Not bad, a widget a week eh? Sounds like a good pace to me. Hopefully I can make it two widgets a week tho. That would be nice since I still have 4 or 5 more to go.
Anyways on to the details. What you see here are actually two different kinds of progress bars. The horizontal bar is made up of two images, while the vertical bar is just made up of two rectangle primitives. Because image and rectangle objects both inherit from a base class, I'm able to use the same code for both of them. Meaning my progress bar class never needs to distinguish between the two objects, it's able to just use the functions from the base object. I could, if I wanted, make the outline a graphic and the bar a primitive, or vice versa.
The horizontal bar is demonstrating the advantage of a graphic progress bar: masking. This lets you make the bar appear to slim up or even (not demoed here) seem to empty a bottle or around a curve. You get the idea.
The vertical bar is demonstrating the advantage of a primitive progress bar: color change. I suppose I could make the grahpic bar a sprite instead of an image so that can switch bar colors too (I'd have to add that functionality) - but this way is so much simpler. And since you can have a bar primitive with an outline graphic...
The way the demo works is I set up two timers. The timers, every set number of milliseconds, message the app saying they've expired. The app then updates the proper progress bar. When the progress bar updates, it calls back the app and the app updates the text and colors. Simple.
As with the last demo, you can download it here. The source is included.
Once again, comments are appreciated!! [smile]