Growing feedback bar
Paul Gr
pauls_postbus at hotmail.com
Thu Aug 2 08:57:32 UTC 2007
Hi Leisha,
If the bar you would like to draw only contains simple graphics primitives (such as rectangles), it would also be possible to draw the bar using some inline script.
Here is an example subroutine that should be placed in the user script section of the Sript window.
Sub DrawProgressBar(someSlide as Slide, _
barObjectName as String, _
progressPos as Single)
Dim cnvs as Canvas
set cnvs = Display.Canvas
' use a text object on slide to position the bar and to define the bar props
Dim bar as SlideText
Set bar = CSlideText(someSlide.States.Item(someSlide.ActiveState). _
Objects(barObjectName))
' check range [0..1]
if progressPos<0 then
progressPos = 0
elseif progressPos>1 then
progressPos = 1
end if
' store the bar position and dimension in temporary variables
Dim h%, x%, y%, w%
x = bar.Left
h = bar.Bottom - bar.Top
y = bar.Top
w = bar.Right - bar.Left
' draw a filled rectangle without border
cnvs.PenWidth = bar.BorderWidth
cnvs.PenColor = bar.BorderColor
cnvs.BackStyle = "opaque"
' first draw the complete bar
cnvs.FillColor = bar.BackColor
cnvs.Rectangle x, y, w, h
' then fill a part of the bar
cnvs.FillColor = bar.ForeColor
dim f as long
f = CInt(w * progressPos)
cnvs.Rectangle x, y, f, h
Set cnvs = Nothing
Set bar = Nothing
end Sub
Before using this subroutine you should place a text object on your slide, which defines the position and color properties of the progress bar. Then you can call the subroutine by specifying the names of the slide and slidetext objects and the progress position (a value ranging from 0 to 1).
For example:
DrawProgressBar Slide1, "Text1", 0.2
hope this helps
Paul
> Date: Wed, 1 Aug 2007 12:52:12 -0700> From: leisha at decisionresearch.org> To: eprime at mail.talkbank.org> Subject: Growing feedback bar> > Hi, all,> > What would be the easiest way to create a bar that grows on the screen? > Subjects can earn up to 28 points, so a green progress bar will grow > every time they earn a point. I have 28 bars of various sizes, but we > want the bar to appear to grow, so I also have a piece of the bar that > is one-quarter of one point. I want to add it to the top of the bar in > quick succession so that the bar appears to grow. The problem is > determining the exact place on the screen to place the little bar piece.> > Is there an easier way?> > Leisha Wharfield> Decision Research> Eugene, Oregon USA>
_________________________________________________________________
Jouw nieuws: wereldnieuws! Beleef 't op MSN.nl
http://reporter.msn.nl/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20070802/77371e89/attachment.htm>
More information about the Eprime
mailing list