selecting an image with the mouse cursor by contact alone (without clicking)

David McFarlane mcfarla9 at msu.edu
Fri Apr 29 14:34:52 UTC 2011


Erin,

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 -- 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...

Basically, what Ben already said.  Inside your loop, you can get 
mouse cursor position using Mouse.GetCursorPos (see the 
MouseDevice.GetCursorPos topic in the online E-Basic Help).  For the 
test, you could use SlideState.HitTest, or PointInRect (see those 
topics in the online E-Basic Help), depending on your tastes and requirements.

E.g., for just one rectangular target zone,

Const  tgtName as String = "Image1"
Dim  x as Long, y as Long
Dim  slState as SlideState  ' for convenience
Set slState = StimSlide.States("Default")
Do  ' loop until mouse enters the named region
     Mouse.GetCursorPos x, y
Loop Until ( (slState.HitTest( x, y ) = tgtName) )

Do be aware that some uses of HitTest and PointInRect include top & 
left edges as part of the rectangle, but exclude bottom & right edges 
as part of the rectangle, in case that is important to you.

Since you want the loop to end when the mouse contacts any of *three* 
distinct areas, you will need to construct a somewhat more elaborate 
conditional clause than in this example, but you get the idea.  And 
if you want to allow for non-rectangular target zones then you will 
have to incorporate some kind of mask into your tests, which I leave 
as an exercise.

-- David McFarlane, Professional Faultfinder


At 4/29/2011 09:08 AM Friday, ben robinson wrote:
>you could use a Do...Loop Until in an Inline to continuously check 
>for mouse cursor position until some condition is met, for instance 
>the cursor's x and y position both meet some requirement (ie, If x > 
>5 and x < 10 and y > 5 and y < 10 Then trial.ACC = 1, trial.RT = 
>clock.read).  does that make sense?
>
>ben
>
>On Thu, Apr 28, 2011 at 5:35 PM, Erin 
><<mailto:erin.siebert at gmail.com>erin.siebert at gmail.com> wrote:
>I want find out how to make an image selection happen by simply having
>the mouse cursor contact an image, without any clicking. My experiment
>is actually a match-to-sample task for chimpanzees using a joystick
>without buttons. I have successfully set up the joystick to control
>the mouse cursor in E-Prime, so the chimp can control the mouse cursor
>using the joystick. I want the chimp to be able to select an image by
>simply contacting the image with the mouse cursor.
>
>The experiment will have three images displayed- a sample image at the
>top of the screen (no response if contacted), then below, 2 images:
>one image that matches the sample (correct if contacted), and a non-
>matching foil image (incorrect if contacted).
>
>So, I need to figure out how to have an image selection happen by
>contact with the mouse cursor alone, and how to designate the image
>response as correct or incorrect. I have searched the E-Prime help,
>and checked the forums with no luck.  I downloaded the sample
>experiment "Response Areas For Mouse Input Sample," but I am not sure
>how to adapt it to select an image without a click.  I am new to E-
>Prime, and would appreciate any information. thank you.
>
>Erin

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
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.



More information about the Eprime mailing list