user button press

1,018 views
Skip to first unread message

tiburona

unread,
Apr 7, 2010, 7:41:49 PM4/7/10
to E-Prime
Hi all,

My ultimate goal is to present words on a page for the participant to
respond to, either via image or text, collect text input from
participants that they see on screen in an EchoClient, and
simultaneously display a "Next" button that participants can use to
advance to the next portion of the experiment when they are done
typing. I've managed the first two elements fine, but getting E Prime
to terminate a screen in response to a button press is eluding me. I
am new to E-Prime and near-hopeless with E-Basic (even though I have a
little programming experience). I will probably eventually resort to
some subobtimal solution, like using the tab key to advance to the
next screen, because I'm skeptical I'll be able to get this running,
but I thought I would try an initial query to the group.

As a preliminary test, I set up a slide object (Slide2) with two
images (Image1 and Image2) on it.

I based this code on sample code from PST:

__________________________________________________

Dim theState as SlideState
Set theState = Slide2.States("Default")

Dim strHit As String
Dim theMouseResponseData As MouseResponseData

If Slide2.InputMasks.Responses.Count > 0 Then


Set theMouseResponseData =
CMouseResponseData(Slide2.InputMasks.Responses(1))

strHit = theState.HitTest(theMouseResponseData.CursorX,
theMouseResponseData.CursorY)

If strHit = "Image1" Then
Slide2.Stop


End If

Do Until (strHit = "Image1")

Loop

End If


_____________________________________________________________

I tried placing it before and after the slide object in a Procedure,
but it didn't work either way (still not sure which is right). I was
wondering if someone could help me understand why. I'm trying to
build up to what I'm actually attempting from smaller bits. I have
found other sample code related to what I'm trying to do (for
instance, here: http://www.pstnet.com/forum/Topic4009-23-1.aspx?Highlight=HitTest)
but when I try to modify it it doesn't work either, so I figure maybe
if I start with a very simple unit I'd have a chance of building up
some understanding.

Thanks very much,
Katie

tiburona

unread,
Apr 7, 2010, 7:45:04 PM4/7/10
to E-Prime
p.s. I would be overjoyed if someone could tell me how to do what I'm
after without resorting to InLine, but I get the feeling that's not
possible.

tiburona

unread,
Apr 7, 2010, 9:23:40 PM4/7/10
to E-Prime
Actually, reading this:

http://groups.google.com/group/e-prime/browse_thread/thread/ab5a034086d67659

made me realize I could perhaps pull the same trick, and put two
slides up in sequence, the first with 0 duration and infinite time
limit that would take the mouse click and then jump to a label after
both slides, the second with infinite duration and infinite time limit
that would have the image with my sentence and the EchoClient that
would allow the participant to time the response.

in fact, maybe this layering isn't even necessary. Maybe I can have
my keyboard EchoClient and my mouse button on the same SlideObject,
and just set the "Allowable" response on the mouse to the "next
button" Slide SubObject, and then choose terminate as the response.

I'm only writing this so I can spare anyone helpful enough to answer
me the trouble of outlining these elements of a solution in their
response.

(Incidentally, so far I am not having luck with the first method
because I can't figure out how to refer to my image file in the
"Allowable" box on the properties of the Mouse Input Mask. I tried
imitating another E Studio experiment someone else in my lab did, and
calling it [Target1] and then putting a Target1 attribute in the--I
don't know the terminology here--parent list (?) for the procedure but
it's giving me one of those "-999: Factor Error: Filename contains an
invalid attribute"s.)

David McFarlane

unread,
Apr 8, 2010, 4:00:51 PM4/8/10
to e-p...@googlegroups.com
Katie,

Stock reminder: 1) I do not work for PST. 2) PST's trained staff
takes any and all questions at
http://support.pstnet.com/e%2Dprime/support/login.asp , and they
strive to respond to all requests in 24-48 hours (although latest
reports indicate more like 10 days) -- this is pretty much their
substitute for proper documentation, so make full use of it. 3) If
you do get an answer from PST Web Support, please extend the courtesy
of posting their reply back here for the sake of others.

That said, here is my take ...


I can't go into full details, but here are a few hints that come to mind:

1) You will have to resort to inline code to do the Slide.HitTest.

2) I would probably use the main Slide to collect just the keyboard
responses. I would use "extended input" (see Appendix C of the
User's Guide that came with E-Prime) with a Duration of 0, increased
MaxCount, EchoClient, etc. I would then follow the Slide with inline
code to get the "Next" mouse click.

3) Unlike other input devices, you do not need an input mask to get
mouse responses, see the MouseDevice topic in the online E-Basic
Help. And because getting the "Next" might take several mouse
clicks, I would get the mouse clicks directly (i.e., without an input
mask) and use Slide.HitTest in a loop in inline code following the Slide.

4) In particular, your code


Do Until (strHit = "Image1")
Loop

is an empty loop and will do nothing useful for you. You need to put
the appropriate code inside that loop.

Hope you find some help in that,
-- David McFarlane, Professional Faultfinder
"For a successful technology, reality must take precedence over
public relations, for nature cannot be fooled." (Richard Feynman,
Nobel prize-winning physicist)

tiburona

unread,
Apr 8, 2010, 5:05:15 PM4/8/10
to E-Prime
Thank you very much for your response, David. I actually managed to
figure out the correct code around the time you were responding. Here
it is for anyone in the future who might google this thread:


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

Dim next_mX as Long, next_mY as Long

Dim strHit As String
Dim theMouseResponseData As MouseResponseData

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

'Get the mouse response
Set theMouseResponseData =
CMouseResponseData(Slide3.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)

'Compare string name where mouse click occurred to CorrectAnswer
'attribute on each trial, and score response
'NOTE: This comparison is case sensitive
If strHit = "Image1" Then
GoTo Label2

End If

End If

Do Until (strHit = "Image1")
' 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 = "Image1" Then
GoTo Label2
End If

Loop

Loop Until (strHit = "Image1")


On Apr 8, 3:00 pm, David McFarlane <mcfar...@msu.edu> wrote:
> Katie,
>


> Stock reminder: 1) I do not work for PST. 2) PST's trained staff
> takes any and all questions athttp://support.pstnet.com/e%2Dprime/support/login.asp, and they
> >http://groups.google.com/group/e-prime/browse_thread/thread/ab5a03408...
--
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.

tiburona

unread,
Apr 8, 2010, 5:06:51 PM4/8/10
to E-Prime
(You'll notice I used your old sample code to do part of it. Thanks
for being such a great resource for confused EPrime newbies like me.)
Reply all
Reply to author
Forward
0 new messages