VAS Speed: Solved.....VAS Code: Almost Solved

Daniel.J.Bates at wheaton.edu Daniel.J.Bates at wheaton.edu
Wed Jun 11 18:25:54 UTC 2003


Thanks for your help everybody.

My code is running much faster.  I discovered that all slideobjects have a
default duration time of 1000 ms.  Once that was placed to 0 ms, my code ran
much faster.  My code has changed a little since my last posting.  I have
included it below.  As you can see, some of the original code has been changed
into a comment (particularly the lines defining slrLeft and slrRight).  This is
because these lines of code incorrectly identifyed the position of the bitmap
and were, therefore, confusing the rest of my calculations.  Instead of trying
to debug those lines of code, I decided to calculate the position of the two
bitmaps that I was using and to enter the numercial value in myself.  A little
messier, perhaps, but at least the bar stays within my scale.  To calculate the
position of those bitmaps, I included some more code in the lines
following "case 3".

My next task is to find a way of calculating the position of my bar within the
scale and then to insert that value into my dataset.  The manual reccomends
using attributes (e.g. c.SetAttrib "Data", TypeVariableHere), but I am still
trying to get that working.

A copy of my code is shown below.  Again...thanks for your help everybody.

Daniel



Dim FinalSelection As Integer
 Dim ScreenWidth As Integer
 Dim NewButtonPosn As Integer
 Dim ButtonPosn As Integer
 Dim RealSliderWidth As Integer
 Dim slrLeft As Integer
 Dim slrRight As Integer
 Dim KeyAscii As Integer

 ScreenWidth = 640
 'slrLeft = CSlideImage(Slide1.States.Item("Default").Objects(3)).X
  slrLeft = 161
 'RealSliderWidth = CSlideImage(Slide1.States.Item("Default").Objects(3)).width
* ScreenWidth / 100
 'slrRight = slrLeft + RealSliderWidth
  slrRight = 479
 ButtonPosn = CSlideImage(Slide1.States.Item("Default").Objects(1)).X
 NewButtonPosn = ButtonPosn

 FinalSelection = 0

 KeyAscii = Wait1.Resp
 'CSlideImage(Slide1.States.Item("Default").Objects(1)).X = 600
 Select Case KeyAscii

   Case 1
     If ButtonPosn >= slrLeft + 20 Then
       NewButtonPosn = ButtonPosn - 20
     Else
       NewButtonPosn = slrLeft
     End If
   Case 2
     If ButtonPosn >= slrLeft + 2 Then
       NewButtonPosn = ButtonPosn - 2
     End If
   Case 3
	 	FinalSelection = 1
		MsgBox "slrLeft = " + Str(slrleft) + " / " + Str((ButtonPosn -
slrLeft) * 100 / (slrRight - slrLeft)) + " percent" + " / " + "slrRight = " +
Str(slrRight)  + " / " + "ButtonPosn = " + Str(ButtonPosn)
		c.SetAttrib "EasMBResponse", Str((ButtonPosn - slrLeft) * 100 /
(slrRight - slrLeft)) + " percent"
   Case 4
     If ButtonPosn <= slrRight - 2 Then
       NewButtonPosn = ButtonPosn + 2
     End If
   Case 5
     If ButtonPosn <= slrRight - 20 Then
       NewButtonPosn = ButtonPosn + 20
     Else
       NewButtonPosn = slrRight
	End If
 End Select

  CSlideImage(Slide1.States.Item("Default").Objects(1)).X = NewButtonPosn
  If FinalSelection = 0 Then
  	Goto Label1
  End If



More information about the Eprime mailing list