need help with code, I am trying to have two clickable response buttons on a slide
David Wang
jiaxiking at gmail.com
Sun Jul 15 05:57:56 UTC 2012
long story short, I am trying to have two response objects that can be
clicked by mouse. My subjects will only be able to click one of them (as
soon as that happens, the procedure will move forward). clicking elsewhere
results in nothing.
I have attached an Inline after that slide, however I can't seem to get the
coding right. Can someone take a look and let me know what I am doing
wrong. Thank you so much :) (by the way I copied this code from someone
in this group, I can't remember her name though, but I love her for sharing
this. Hopefully I can get it to work in my design).
The slide I want to make this work is "slide5", the two buttons are named
"leftbutton" and "right button". I will need to log which button my
subjects will click for the purpose of my experiment.
here are the codes:
============================================================================
'Designate "theState" as the Default Slide State, which is the
'current, ActiveState on the Slide object "Stimulus"
Dim theState as SlideState
Set theState = Slide5.States("Default")
Dim next_mX as Long, next_mY as Long
Dim strHit As String
Dim theMouseResponseData As MouseResponseData
Do until (strHit = "leftbutton" or strHit = "rightbutton")
'Was there a response?
If Slide5.InputMasks.Responses.Count > 0 Then
'Get the mouse response
Set theMouseResponseData =
CMouseResponseData(Slide5.InputMasks.Responses(1))
'Determine string name of Slide or SlideText object
at
'mouse click coordinates. Assign that value to
strHit
strHit =
theState.HitTest(theMouseResponseData.CursorX,theMouseResponseData.CursorY)
'Compare string name where mouse click occurred to
CorrectAnswer
'attribute on each trial, and score response
'NOTE: This comparison is case sensitive
If strHit = "leftbutton" or strHit = "rightbutton"
Then
GoTo begingame
End if
Do Until (strHit = "leftbutton" or strHit = "rightbutton")
' capture & process further mouse clicks:
If (Mouse.Buttons And ebMouseButton1) Then
Mouse.GetCursorPos next_mX, next_mY
strHit = theState.HitTest( next_mX, next_mY
)
End If
If strHit = "leftbutton" or strHit = "rightbutton"
Then
GoTo begingame
End If
Loop
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To view this discussion on the web visit https://groups.google.com/d/msg/e-prime/-/W-8a1QqvHZgJ.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20120714/d968a488/attachment.htm>
More information about the Eprime
mailing list