strHit not returning correct answer

112 views
Skip to first unread message

Ren

unread,
Feb 6, 2012, 3:58:08 PM2/6/12
to E-Prime
Hello,

I am trying to build a program to use a mouse click to select a
correct answer, which is pulled from the TrialList. Something is wrong
in that the program doesn't seem to find anything to match the
"Correct Answer" category, and always returns a negative result. I am
using this code:


'Designate "theState" as the Default Slide State, which is the
'current, ActiveState on the Slide object "Stimulus"
Dim theState as SlideState
Set theState = SLIDENAME.States("SLIDESTATENAME")

Dim strHit As String
Dim theMouseResponseData As MouseResponseData

'Was there a response?
If SLIDENAME.InputMasks.Responses.Count > 0 Then

'Get the mouse reponse
Set theMouseResponseData =
CMouseResponseData(SLIDENAME.InputMasks.Responses(1))

'Determine string name of the SlideImage 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 occured to CorrectAnswer
'attribute on each trial, and score response
'NOTE: This comparison is case sensitive
If strHit = c.GetAttrib("CORRECTANSWERCOLUMN") Then
SLIDENAME.ACC = 1
Else
SLIDENAME.ACC = 0
End If


End If
c.SetAttrib "Response", strHit

I have tried putting a text box on my slide with a word such as
"BLUE", then listing BLUE under the correct answer column and it still
will not return a correct response. I have also tried using images and
renaming most of the items on the slide to try to isolate the problem,
but nothing has worked. My mouse is turned on and the correct response
is [CORRECTANSWERCOLUMN] and allowable response {ANY}.

Any ideas? Using a mouse is essential because this will be a touch
screen program used with non-human primates. I've submitted this to
PST support, but it's been a few days and I would really like to get
this program up and running.

ben robinson

unread,
Feb 6, 2012, 4:11:29 PM2/6/12
to e-p...@googlegroups.com
have you tried using Debug.Print to help you figure out what value
strHit actually has following a mouse click? i think you'll find that
strHit="SlideText1" or something like that, rather than "BLUE".
strHit only tells you the name of the object clicked, not what text is
actually displayed by that object.

ben

> --
> You received this message because you are subscribed to the Google Groups "E-Prime" group.
> To post to this group, send email to e-p...@googlegroups.com.
> To unsubscribe from this group, send email to e-prime+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.
>

Ren

unread,
Feb 7, 2012, 12:31:01 PM2/7/12
to E-Prime
Yes! That's exactly what fixed it. I tried subbing out all different
parts of my program, but that didn't even occur to me.

Thanks!
Reply all
Reply to author
Forward
0 new messages