mouse click on target

ftornay at ugr.es ftornay at ugr.es
Wed Jan 15 16:29:10 UTC 2003


Mensaje citado por "Custers, Ruud" <R.Custers at fss.uu.nl>:

> Hi everyone,
>
> I have what I think should be a simple problem. I want participants to click
> rapidly on a box that appears on the screen and to test whether they
> actually clicked on the box or missed it. Does anybody know how to do this?
>
> Thanks,
>
> Ruud.
>
>

Do this:
a) Insert a slide object. Let's call it "Target". Set their duration/input
properties to get it accept mouse input. If you write 1 on the allowable
property only left clicks will be allowed. Don't forget to set the data logging
property to "standard", so that responses are logged.
b) Insert a text object within the slide, let's call it "TargetBox". Leave it
blank. Then set the borderwidth property (on the frame tab) to some nonnull
value. You will have a box on the screen. You can then set the other properties
(position, size, bordercolor, backcolor, ...) as desired.
c) Insert an inline object after the slide. You should write the following:

'Find out whether there was a click
'Important: The mouse device should be the first device on the slide.
Dim mouseClicks As Integer
mouseClicks = Target.InputMasks.Item(1).Responses.Count

'If so, get the mouse response
If mouseClicks > 0 Then
	Dim rdClick As MouseResponseData	
	Set rdClick = CMouseResponseData( _
	Target.InputMasks.Item(1).Responses(1))

'Did the box get clicked?
	If Target.States(Target.ActiveState).HitTest( _
         rdClick.CursorX, rdClick.CursorY) = "TargetBox" then
		Target.acc = 1
	Else
		Target.acc = 0
	End If
Else
	Target.acc = 0
End If


This way the response to the slide object will be considered correct if the box
was clicked and incorrect otherwise.
You may also want to set the show cursor property of the mouse device object
(in the experiment object, devices tab) to yes, so that the mouse cursor is
visible.

Hope this helps,

Francisco Tornay



More information about the Eprime mailing list