20890<_VersionPersist dt:dt="int">50SessionProcPsychology Software Tools, Inc. (Matt Lenhart)This sample experiment demonstrates two methods for implementing a
Visual Analog Scale.
The first method utilizes multiple SlideText sub-objects placed in a line on a Slide
object. Each SlideText is named "Text" followed by a digit. The digit will represent the
subject's relative rating to the presented question or statement. The SlideText clicked
by the subject is determined using the HitTest method and the rating is logged in the
data file.
The second method utilizes the Canvas object to draw multiple rectangles in a line on
the screen. After the subject responds, InLine script is used to determine if the
subject's click was within one of the rectangles and the rating is logged in data file
appropriately.
2013-08-19T16:51:31.000536870912DisplayDisplay<_VersionPersist dt:dt="int">1-164048016white1NoKeyboardKeyboard<_VersionPersist dt:dt="int">1-1101MouseMouse<_VersionPersist dt:dt="int">1-1100SoundSound<_VersionPersist dt:dt="int">1-122205016-1-10-1BlockTrialSubTrialLogLevel5LogLevel6LogLevel7LogLevel8LogLevel9LogLevel1010SubjectPlease enter the Subject Number (1-32767, 0=No Data Logging):0-1-11032767SessionPlease enter the Session Number (1-32767):0-1-11132767GroupPlease enter Subject's Group (0-32767):0001032767NamePlease enter Subject's Name:100255AgePlease enter Subject's Age (0-150):00000150SexPlease enter Subject's Sex:200malemalefemaleHandednessEnter Subject's Handedness:200leftleftrightResearcherIDPlease enter Researcher's ID:0001032767SessionProcProcedure{B423F1A1-0FBB-4387-89C1-9E685433B422}20887<_VersionPersist dt:dt="int">1- Intro
- BlockList
- Goodbye
1IntroBlockListGoodbyeGoodbyeTextDisplay{53F97124-7172-4B09-AAD2-578953FD2CD0}20887<_VersionPersist dt:dt="int">1OnsetDelay0OnsetTime0DurationError0PreRelease0Duration0StartTime0OffsetTime0FinishTime0TimingMode0CustomOnsetTime0CustomOffsetTime0ActionDelay0ActionTime0TargetOffsetTime0TargetOnsetTime0OffsetDelay0RTTime0ACC0RT0RESP0CRESP0Tag020000010blackwhiteopaqueblack0centercenter100%100%centercentercentercenterNoCourier New18YesNoNoNoThank you for participating.
Goodbye!-1BlockListList{DC6BEF43-7F45-47A4-9918-D001D02B01E5}20887<_VersionPersist dt:dt="int">1- SlideProc
- CanvasProc
00000001100Weight17510Nested17511Procedure175121 SlideProc1 CanvasProcSlideProcProcedure{59DDED0B-0F52-493E-8608-6FDCE26E1042}20887<_VersionPersist dt:dt="int">1- SlideInstructions
- TrialList1
1SlideInstructionsTrialList1SlideInstructionsTextDisplay{9C8C6E7D-ADF9-43A1-9BE8-924F1898D8FD}20887<_VersionPersist dt:dt="int">1OnsetDelay0OnsetTime0DurationError0PreRelease0Duration0StartTime0OffsetTime0FinishTime0TimingMode0CustomOnsetTime0CustomOffsetTime0ActionDelay0ActionTime0TargetOffsetTime0TargetOnsetTime0OffsetDelay0RTTime0ACC0RT0RESP0CRESP0Tag0MouseMouse11111Yes-10010blackwhiteopaqueblack0centercenter100%100%centercentercentercenterNoCourier New18YesNoNoNoThis is the first method, which utilizes multiple SlideText sub-objects. The name of each SlideText corresponds to the score value that will be recorded when the subject clicks on it. The HitTest method is used to determine which SlideText was clicked.
Please press the left mouse button to continue.-1TrialList1List{A9255B36-6E0E-4847-8FD7-D8D251F02228}20887<_VersionPersist dt:dt="int">1- TrialProc1
00000001100Weight17510Nested17511Procedure175121 TrialProc11 TrialProc11 TrialProc1TrialProc1Procedure{55E0F066-87C6-4B08-9520-73A8A828ADAF}20887<_VersionPersist dt:dt="int">1- Init
- Stimulus
- DoHitTest
- Feedback
1InitStimulusDoHitTestFeedbackInitInLine{595E9AA5-5C1E-433F-8B13-54C036425F88}20887<_VersionPersist dt:dt="int">1Mouse.ShowCursor TRUE
StimulusSlideThe Duration is set to infinite and the mouse is allowed as input.
Once the subject has responded, the DoHitTest InLine will determine if a SlideText
sub-object was clicked and the rating will be logged appropriately.{57C82B9A-E54E-4BFD-9662-A06A8D9C2CF0}201025<_VersionPersist dt:dt="int">15OnsetDelay1OnsetTime1DurationError1PreRelease0Duration0StartTime0OffsetTime0FinishTime0TimingMode0CustomOnsetTime0CustomOffsetTime0ActionDelay0ActionTime0TargetOffsetTime0TargetOnsetTime0OffsetDelay0RTTime1ACC1RT1RESP1CRESP1Tag0MouseMouse11111YesDefaultwhiteopaqueblack0centercenter100%100%centercenterNoYesSlideTextQuestionblackwhiteopaque0blackcenter25%100%50%centercentercentercenterCourier New18YesNoNoNoRate your agreement with this sentence.
<- Strongly Disagree Strongly Agree ->-1SlideTextText1whitegreenopaque1white20%85%15%20%centercentercentercenterCourier New18YesNoNoNo1-1SlideTextText2whitegreenopaque1white35%85%15%20%centercentercentercenterCourier New18YesNoNoNo2-1SlideTextText3whitegreenopaque1white50%85%15%20%centercentercentercenterCourier New18YesNoNoNo3-1SlideTextText4whitegreenopaque1white65%85%15%20%centercentercentercenterCourier New18YesNoNoNo4-1SlideTextText5whitegreenopaque1white80%85%15%20%centercentercentercenterCourier New18YesNoNoNo5-1-10Default010DoHitTestInLine{EA29C24C-8F64-4D16-A71C-605E3D509701}20887<_VersionPersist dt:dt="int">1'Designate "theState" as the Default Slide State, which is the
'current ActiveState on the Slide object "Stimulus".
Dim theState As SlideState
Set theState = Stimulus.States("Default")
Dim theSlideText As SlideText
Dim strHit As String
Dim intRating As Integer
Dim theMouseResponseData As MouseResponseData
'Was there a response?
If Stimulus.InputMasks.Responses.Count > 0 Then
'Get the mouse response.
Set theMouseResponseData = CMouseResponseData(Stimulus.InputMasks.Responses(1))
'Determine string name of SlideText object at
'mouse click coordinates. Assign that value to strHit
strHit = theState.HitTest(theMouseResponseData.CursorX, theMouseResponseData.CursorY)
'Did the subject click one of the SlideText sub-objects?
If strHit <> "" And strHit <> "Question" Then
'Gain access to the SlideText sub-object selected
'Change appearance of selected sub-object to provide feedback to the subject.
Set theSlideText = CSlideText(Stimulus.States.Item("Default").Objects(strHit))
theSlideText.BackColor = CColor("red")
'Redraw the Slide to present changes
Stimulus.Draw
'Each SlideText is named "Text" followed by a single digit. The Mid function is
'instructed to return the 5th character (i.e. the digit) of strHit for logging purposes.
intRating = CInt(Mid(strHit, 5, 1))
'Log rating in the data file under the attribute "Rating"
c.SetAttrib "Rating", intRating
Sleep 1000
theSlideText.BackColor = CColor("green")
'The subject did not click a valid sub-object.
Else
c.SetAttrib "Rating", "nothing"
End If
'The subject did not respond.
Else
c.SetAttrib "Rating", "nothing"
End If
Set theMouseResponseData = Nothing
Mouse.ShowCursor False
FeedbackTextDisplay{7EB02587-A974-4F90-AA82-86E22B2F2BA2}20887<_VersionPersist dt:dt="int">1OnsetDelay0OnsetTime0DurationError0PreRelease0Duration0StartTime0OffsetTime0FinishTime0TimingMode0CustomOnsetTime0CustomOffsetTime0ActionDelay0ActionTime0TargetOffsetTime0TargetOnsetTime0OffsetDelay0RTTime0ACC0RT0RESP0CRESP0Tag010000010blackwhiteopaqueblack0centercenter100%100%centercentercentercenterYesCourier New18YesNoNoNoYou chose [Rating].-1CanvasProcProcedure{A4E6BEDB-D527-4599-8C58-0055FAD15D65}20887<_VersionPersist dt:dt="int">1- CanvasIntro
- TrialList2
1CanvasIntroTrialList2CanvasIntroTextDisplay{2861B129-F9D2-409C-BFE5-98CC2A64FC71}20887<_VersionPersist dt:dt="int">1OnsetDelay0OnsetTime0DurationError0PreRelease0Duration0StartTime0OffsetTime0FinishTime0TimingMode0CustomOnsetTime0CustomOffsetTime0ActionDelay0ActionTime0TargetOffsetTime0TargetOnsetTime0OffsetDelay0RTTime0ACC0RT0RESP0CRESP0Tag0MouseMouse11111Yes-10010blackwhiteopaqueblack0centercenter100%100%centercentercentercenterYesCourier New18YesNoNoNoThis is the second method, which utilizes the Canvas object. Multiple rectangles are drawn the screen, each representing an individual score on the scale. The PointInRect method is used to determine which rectangle the subject clicked and logs their score appropriately.
Please press the left mouse button to continue.-1TrialList2List{D98F5C84-0A19-4100-ABA8-2E50C3EDCC5F}20887<_VersionPersist dt:dt="int">1- TrialProc2
00000001100Weight17510Nested17511Procedure175121 TrialProc21 TrialProc21 TrialProc2TrialProc2Procedure{97ED7307-D134-4829-892E-61332F2DF6D3}20887<_VersionPersist dt:dt="int">1- DrawScale
- Stimulus2
- GetRating
- Feedback
1DrawScaleStimulus2GetRatingFeedbackDrawScaleInLine{27CA0023-243B-48A6-B55C-6DC33B60FEBE}20887<_VersionPersist dt:dt="int">1Mouse.ShowCursor True
Dim cnvs As Canvas
Set cnvs = Display.Canvas
Dim i As Integer, x As Integer, y As Integer, xWidth As Integer
'Set total number of rectangles needed, and the width and height of each rectangle.
Const totalRect As Integer = 5
Const w As Integer = 100
Const h As Integer = 100
'Set starting X and Y coordinates for rectangles.
'X = 50% of resolution. Y = 75% of resolution.
x = Display.XRes * .5
y = Display.YRes * .75
'This variable holds a value that is subtracted from the starting X coordinate so that the
'rectangles will be centered.
xWidth = (w*(totalRect)/2)
cnvs.PenColor = CColor("white")
cnvs.FillColor = CColor("green")
cnvs.FontSize = 18
cnvs.TextColor = CColor("white")
'Draw rectangles.
For i = 1 To totalRect
cnvs.Rectangle x - xWidth, y, w, h
'Display number corresponding to the rating inside each box.
cnvs.BackStyle = "Transparent"
cnvs.Text x - xWidth + (w/2.5), y + (h/3), i
cnvs.BackStyle = "Opaque"
'Decrease pixel amount that is subtracted from starting X coordinate (i.e. next
'rectangle will be drawn w pixels to the right of the last rectangle).
xWidth = xWidth - w
Next i
Stimulus2TextDisplayThe Frame Height is set to 25% and the BackStyle is set to transparent so the question
will appear on screen without clearing the rectangles.{671E0436-5145-4510-98B0-E17CDAE90969}20887<_VersionPersist dt:dt="int">1OnsetDelay1OnsetTime1DurationError1PreRelease0Duration0StartTime0OffsetTime0FinishTime0TimingMode0CustomOnsetTime0CustomOffsetTime0ActionDelay0ActionTime0TargetOffsetTime0TargetOnsetTime0OffsetDelay0RTTime1ACC1RT1RESP1CRESP1Tag0MouseMouse11111Yes-10010blackwhitetransparentblack0center25%100%50%centercentercentercenterNoCourier New18YesNoNoNoRate your agreement with this sentence.
<- Strongly Disagree Strongly Agree ->-1GetRatingInLine{8F3DFC52-1303-42AB-852C-2EBD809C4BA5}20887<_VersionPersist dt:dt="int">1'Retrieve mouse click location and store in Point variable to send to PointInRect
Dim theMouseResponseData As MouseResponseData
Set theMouseResponseData = CMouseResponseData(Stimulus2.InputMasks.Responses(1))
Dim ptr As Point
ptr.x = theMouseResponseData.CursorX
ptr.y = theMouseResponseData.CursorY
xWidth = (w*(totalRect/2))
'Compare mouse click coordinates to each rectangle and assign the appropriate
'score to the Score attribute.
For i = 1 To totalRect
Dim rectRate As Rect
rectRate.Left = x - xWidth
rectRate.Right = x - xWidth + w
rectRate.Top = y
rectRate.Bottom = y + h
'Was the mouse click within the defined rectangle?
If PointInRect(ptr, rectRate) Then
'Present visual feedback to the user (color selected rectangle red).
cnvs.FillColor = CColor("red")
cnvs.Rectangle x - xWidth, y, w, h
cnvs.BackStyle = "Transparent"
cnvs.Text x - xWidth + (w/2.5), y + (h/3), i
cnvs.BackStyle = "Opaque"
Sleep 1000
'Log rating in the data file under the attribute "Rating"
c.SetAttrib "Rating", i
Exit For
'Mouse click coordinates were not in any of the designated rectangles, so the
'subject did not click on a rating box.
ElseIf i >= totalRect Then
c.SetAttrib "Rating", "nothing"
Exit For
End If
'Decrease pixel amount that is subtracted from starting X coordinate.
xWidth = xWidth - w
Next i
Set theMouseResponseData = Nothing
Mouse.ShowCursor False
IntroTextDisplay{242470E8-7FB9-4F00-9A39-87E54C746AED}20887<_VersionPersist dt:dt="int">1OnsetDelay0OnsetTime0DurationError0PreRelease0Duration0StartTime0OffsetTime0FinishTime0TimingMode0CustomOnsetTime0CustomOffsetTime0ActionDelay0ActionTime0TargetOffsetTime0TargetOnsetTime0OffsetDelay0RTTime0ACC0RT0RESP0CRESP0Tag0MouseMouse11111Yes-10010blackwhiteopaqueblack0centercenter100%100%centercentercentercenterNoCourier New18YesNoNoNoThis experiment will demonstrate two different methods for implementing a "Visual Analog Scale".
Please press the left mouse button to continue.-1