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 21:20:37 UTC 2012


Hi Anne!

Thank you very much for the fast reply.  You are awesome!!!

For my experiment, I want to have the subjects only be able to click on the 
two buttons. So when they accidentally clicks something else (e.g. another 
image object or simply anywhere on the screen other than the two buttons), 
nothing would happen. Once they successfully clicks one of the two buttons, 
the game trial will then restart and go to begingame (a label in the 
beginning of the trialproc).

So I used your code and edited it to make it work.

Here are the working codes, maybe other new eprime users like me can 
benefit from this.. :D

================================================

'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


        '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 SlideImage or SlideText object at
                'mouse click coordinates. Assign that value to strHit
                strHit = theState.HitTest(theMouseResponseData.CursorX, 
theMouseResponseData.CursorY)

                'if strHit equals the two buttons, then strHit will be 
logged, game will move onto next trial.
             
                      If strHit = ("leftbutton") or strHit = 
("rightbutton") Then
                     c.SetAttrib "response", strHit

                'if click is off, then restart slide 5 so nothing changes 
on the screen. no data will be logged in this case. 

                     Else
                     Goto restart

                        End If 
        End if




-- 
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/-/txb4WKMIdB0J.
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/20120715/7e278aea/attachment.htm>


More information about the Eprime mailing list