multiple mouse click recording on a single picture (not slide)

David McFarlane mcfarla9 at msu.edu
Mon Nov 19 19:19:46 UTC 2012


Eszter,

2) To hide the mouse cursor, use
     Mouse.ShowCursor False
in InLine code; to show the cursor again, use
     Mouse.ShowCursor True
.

See the MouseDevice.ShowCursor topic in the E-Basic Help.

-- David McFarlane


At 11/17/2012 12:59 PM Saturday, Eszter Kormann wrote:
>Dear Paul,
>
>please don't get tired of my stupid questions... I have two more.:)
>
>
>1)  I could not make this previous one work, so I decided to go into 
>your suggestion and ask how can I set up a slide that you have 
>already mentioned. I had this idea on my mind when I had started to 
>plan the experiment, but I thought that I will be challenging and 
>hard to make approximately 30 slides. But now I understood that the 
>analysis of the data will be a pain and even harder with this 
>design, so I would be grateful if you could explain how can I switch 
>to the latter solution.
>
>2) The second and most shamefully easy question would be in 
>connection with mouse hiding. I want the cursor to be hidden through 
>the part, when the program just shows the pictures. If it is there 
>the cursor can be distracting in a visual paradigm like this. 
>However, I really need the mouse to be shown when we ask for and 
>register mouse response (through the exposition of the grid 
>exercise). I found this in the help, but I'm a starter (it was a 
>week ago when I first saw the programme.. ), and I don't know how 
>could I make this work.
>
>
>'This example loops through the available mouse cursors.
>
>'EXAMPLE PART A
>
>Instructions.Text = "Press the spacebar to \n begin " &_
>
>"the mouse cursors demo..."
>
>'EXAMPLE PART B
>
>Display.Canvas.Clear
>
>Display.Canvas.Text 0, 0, "Display the available mouse cursors..."
>
>Mouse.ShowCursor True
>
>Dim i As Integer
>
>For i = 1 to 13
>
>Mouse.ShowCursor False
>
>Mouse.Cursor = i
>
>Mouse.SetCursorPos Display.XRes/2, 20
>
>Mouse.ShowCursor True
>
>Display.Canvas.Text 50, 25, "Current mouse " &_
>
>"cursor value = " & Mouse.Cursor
>
>Sleep 2000
>
>Next i
>
>Display.Canvas.Clear
>
>Mouse.ShowCursor False
>
>c.SetAttrib "Stimulus", "End of cursors demonstration "
>
>StimDisplay.Run
>
>'terminate the rest of the experiment
>
>StimDisplay.Duration = 0 'do not display the normal StimDisplay
>
>List1.Terminate 'do not cycle
>
>'Note: To run this example with E-BasicExample.es, copy the script in
>'EXAMPLE PART A above and paste it into the Setup InLine object. Next
>'copy the script in EXAMPLE PART B above and paste it into the Before
>'InLine object.
>
>
>Thanks a lot!!!!!!
>
>Eszter
>
>
>
>
>2012/11/16 Paul Groot <<mailto:pfc.groot at gmail.com>pfc.groot at gmail.com>
>Hi again Eszter,
>
>There are several way's to do this, but assuming your bitmap 
>pictures are drawn unstretched in the middle of the screen (and have 
>fixed dimensions), then you could try something like this (be 
>warned, this will be uggly):
>
>         Const N_x As Integer = 4 ' number of images hor.
>         Const N_y As Integer = 4 ' number of images vert.
>         Const size_x As Long = 1000 ' width of bitmap in pixels
>         Const size_y As Long = 776  ' height of bitmap in pixels
>         Dim offset_x As Long
>         Dim offset_y As Long
>         Dim index_x As Integer
>         Dim index_y As Integer
>         Dim delta_x As Long
>         Dim delta_y As Long
>         offset_x = (size_x - Display.XRes)/2
>         delta_x = size_x / N_x
>         index_x = (theMouseResponseData.CursorX-offset_x)/delta_x
>         offset_y = (size_y - Display.YRes) / 2
>         delta_y = size_y / N_y
>         index_y = (theMouseResponseData.CursorY-offset_y)/delta_y
>
>         Dim index As Integer
>         index = (index_y-1)*N_x+index_x
>         debug.print "I=" & index & "  (" & index_x & "," & index_y & ")"
>
>You could put this inside the if-then-endif part to get the subimage 
>indices of the selected images (ranging from 1 to 16; counting 
>row-by-row) The next thing to do would be a simple test if the 
>indices match the correct answer. Normally you would but the correct 
>answer as attributes in the trial list. However, because all 8 
>clicks are handled within a single trial, you would have to specify 
>the correct indices for all 8 clicks as 8 separate attributes (i.e. 
>'CorrectCLick.1', 'CorrectCLick.2' etc.).
>
>         Dim correct_index As Integer
>         correct_index = CInt(c.GetAttrib("CorrectClick." & CStr(iResponse)))
>         c.SetAttrib "ClickACC." & CStr(iResponse), IIf(index = 
> correct_index, 1, 0)
>
>I'm sure there are dozens of bugs in this code, but this is the 
>general idea if your stimulus is a single bitmap image. As said 
>before, this is not a very elegant piece of work. And there still 
>things going wrong here (for example: the black borders are also 
>treated as valid subimage area). A more elegant way would be to use 
>a hidden bitmap that has a color map that mappes the valid subimage 
>areas to a subimage number. Then a simple getpixel-call would return 
>the selected image. (Also works for non-rectangular areas.) Another 
>option would be to use a slide with 4x4 separate slide images. This 
>would also simplify the script because EStudio has a special HitTest 
>function that can be used to test which object was selected.
>
>
>Cheers
>Paul
>
>
>
>2012/11/15 Eszter Kormann <<mailto:ringril at gmail.com>ringril at gmail.com>
>
>Dear Paul,
>
>thank you for your quick and amazing answer, everything works :)
>However, we faced the problem of marking good and bad answers in 
>this case, because we only get the x and y coordinates for the 
>clicks whereas we need to compare this with the small pictures 
>coordinates on the screen.
>I don't know if I made it clear or not, but we would like to 1) 
>pinpoint the frames for the small pictures 2) define which (small) 
>picture within the grid is meant to be a good answer in the trial 
>and 3) then we want the program to decide whether the click of the 
>responder was correct or not.
>We thought that we might use something like an if "mouse coordinate 
>is XY" < x1  > x2 then "YES", otherwise NO.  Sorry for the form, but 
>unfortunately I still don't know this language.
>
>I know it sounds awfully complicated, but I really need your help.
>
>Thanks a lot in advance!!!
>All the best,
>Eszter
>
>
>2012/11/13 Paul Groot <<mailto:pfc.groot at gmail.com>pfc.groot at gmail.com>
>Hi Eszter,
>
>You could change the inline script a bit, but you would first have 
>to set the number of allowed responses of the inputmask to 8 (click 
>the advanced button and edit max count). Then use the following 
>script after the stimulus object:
>
>Dim iResponse As Integer
>For iResponse = 1 To Stimulus.InputMasks.Responses.Count
>     Dim theMouseResponseData As MouseResponseData
>     Set theMouseResponseData = 
> CMouseResponseData(Stimulus.InputMasks.Responses(iResponse))
>     If Not theMouseResponseData Is Nothing Then
>         c.SetAttrib "Stimulus." & CStr(iResponse) & ".RespCursorX", 
> theMouseResponseData.CursorX
>         c.SetAttrib "Stimulus." & CStr(iResponse) & ".RespCursorY", 
> theMouseResponseData.CursorY
>         c.SetAttrib "Stimulus." & CStr(iResponse) & ".RT", 
> theMouseResponseData.RT
>     End If
>Next
>
>I also added the response time to the output because you might need 
>that too. (Or just delete that line if you don't) The attached 
>script contains a working example.
>
>Normally I would prefer a separate list object with 8 'subtrials' to 
>handle the individual mouse clicks. The advantage would be a 
>more  more compact edat-output file(because you don't have to 
>generate separate attribute names for sequential responses). Another 
>advantage is that you could implement more sophisticated 
>constructions, like highlighting the selected objects as soon as 
>they are selected or terminating after a specific object was 
>selected. However, the disadvantage is that it is slightly more 
>complex if response time recording should be accurate.
>
>Hope this helps.
>
>Cheers,
>Paul
>
>
>2012/11/13 Eszter Kormann <<mailto:ringril at gmail.com>ringril at gmail.com>
>
>Hello,
>
>So, once again :)
>I have a very simple problem in connection with collecting multiple 
>mouse response coordinates. We use a single picture which consists 
>of several pictures in a 4X4 grid (I've attached a sample). People 
>are asked to click on those pictures within the grid which we had 
>already shown to them (8 clicks out of 16). How can I register all 
>of the 8 clicks's coordinates  with the modification of the script 
>linked below, which in fact works perfectly well for our experiment.
>
>
>
>
>If Stimulus.InputMasks.Responses.Count > 0 Then
>
>Dim theMouseResponseData As MouseResponseData
>Set theMouseResponseData = 
>CMouseResponseData(Stimulus.InputMasks.Responses(1))
>If theMouseResponseData Is Nothing Then
>c.SetAttrib "Stimulus.RespCursorX", theMouseResponseData.CursorX
>c.SetAttrib "Stimulus.RespCursorY", theMouseResponseData.CursorY
>End If
>
>End If
>
>
>Thanks a lot,
>Eszter

-- 
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 https://groups.google.com/groups/opt_out.



More information about the Eprime mailing list