Hello everyone, <div><br></div><div>I managed to find a way to randomize images using 'random'. I am however having trouble finding documentation that allows one to record mouse click responses, and corresponding mouse co-ordinates using canvas option. I realize the inflexilibility in not using the input mask option, but my code is structured as such. A portion of my code is shown below:</div><div><br></div><div><div>'use the Canvas method to create an active display canvas</div><div>Set cnvs = Display.Canvas</div><div><br></div><div>'use the CreateCanvas to create an off-screen canvas for neg left</div><div>Set offScreenCnvsNeg1 = Display.CreateCanvas</div><div><br></div><div>''use the CreateCanvas to create an off-screen canvas for pos left</div><div>Set offScreenCnvsPos1 = Display.CreateCanvas</div><div><br></div><div>'use the CreateCanvas to create an off-screen canvas for neg right</div><div>Set offScreenCnvsNeg2 = Display.CreateCanvas</div><div><br></div><div>''use the CreateCanvas to create an off-screen canvas for pos right</div><div>Set offScreenCnvsPos2 = Display.CreateCanvas</div><div><br></div><div><br></div><div>'Define the copy area</div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div>Dim LeftNegSrc As Rect</div><div>Dim LeftNegDest As Rect</div><div>Dim LeftPosSrc As Rect</div><div>Dim LeftPosDest As Rect</div><div><br></div><div><br></div><div>Dim RightNegSrc As Rect</div><div>Dim RightNegDest As Rect</div><div>Dim RightPosSrc As Rect</div><div>Dim RightPosDest As Rect</div><div><br></div><div><br></div><div>Const RECT_WIDTH = 424</div><div>Const RECT_HEIGHT = 283</div><div><br></div><div>'Prepare the rectangles that would be used to draw the offscreen </div><div>'rectangles and the display destination rectangle for where it will</div><div>'be drawn to the screen. </div><div><br></div><div>'Allow the src rectangles Left and Top coordinates to describe/cover the </div><div>'range of Left and Right options that can be chosen. Setting Left and Top </div><div>'to zero means you can choose Left and Right as anything in the dest rect.</div><div><br></div><div>'Right, Bottom options are restricted/defined by width -no flexibility </div><div>'in this option.</div><div><br></div><div>'In our case, width,height were respectively defined as 424, 283, given</div><div>'the image dimensions.</div><div><br></div><div>'NEGATIVE IMAGES: LHS:</div><div><br></div><div>'define src rect</div><div>LeftNegSrc.Left = 0</div><div>LeftNegSrc.Top = 0 </div><div>LeftNegSrc.Right = LeftNegSrc.Left + RECT_WIDTH</div><div>LeftNegSrc.Bottom = LeftNegSrc.Top + RECT_HEIGHT </div><div><br></div><div>'define dest rect</div><div>LeftNegDest.Left = 100</div><div>LeftNegDest.Top = 220</div><div>LeftNegDest.Right = LeftNegDest.Left + RECT_WIDTH </div><div>LeftNegDest.Bottom = LeftNegDest.Top + RECT_HEIGHT</div><div><br></div><div><br></div><div>'POSITIVE IMAGES FOR LHS OF SCREEN</div><div><br></div><div>'define src rect</div><div>LeftPosSrc.Left = 0</div><div>LeftPosSrc.Top = 0 </div><div>LeftPosSrc.Right = LeftPosSrc.Left + RECT_WIDTH</div><div>LeftPosSrc.Bottom = LeftPosSrc.Top + RECT_HEIGHT </div><div><br></div><div>'define dest rect</div><div>LeftPosDest.Left = 100</div><div>LeftPosDest.Top = 220</div><div>LeftPosDest.Right = LeftPosDest.Left + RECT_WIDTH </div><div>LeftPosDest.Bottom = LeftPosDest.Top + RECT_HEIGHT</div><div><br></div><div><br></div><div><br></div><div><br></div><div>'NEGATIVE IMAGES: RHS:</div><div><br></div><div>'define src rect</div><div>RightNegSrc.Left = 0</div><div>RightNegSrc.Top = 0 </div><div>RightNegSrc.Right = RightNegSrc.Left + RECT_WIDTH</div><div>RightNegSrc.Bottom = RightNegSrc.Top + RECT_HEIGHT </div><div><br></div><div>'define dest rect</div><div>RightNegDest.Left = 767</div><div>RightNegDest.Top = 220</div><div>RightNegDest.Right = RightNegDest.Left + RECT_WIDTH </div><div>RightNegDest.Bottom = RightNegDest.Top + RECT_HEIGHT</div><div><br></div><div><br></div><div><br></div><div>'POSITIVE IMAGES FOR RHS OF SCREEN</div><div><br></div><div>'define src rect</div><div>RightPosSrc.Left = 0</div><div>RightPosSrc.Top = 0 </div><div>RightPosSrc.Right = RightPosSrc.Left + RECT_WIDTH</div><div>RightPosSrc.Bottom = RightPosSrc.Top + RECT_HEIGHT </div><div><br></div><div>'define dest rect</div><div>RightPosDest.Left = 767</div><div>RightPosDest.Top = 220</div><div>RightPosDest.Right = RightPosDest.Left + RECT_WIDTH </div><div>RightPosDest.Bottom = RightPosDest.Top + RECT_HEIGHT</div><div><br></div><div>offScreenCnvsNeg1.clear</div><div>offScreenCnvsPos1.clear</div><div>offScreenCnvsNeg2.clear</div><div>offScreenCnvsPos2.clear</div><div><br></div><div><br></div><div>select case random(1,2)</div><div> case 1</div><div> offScreenCnvsNeg1.LoadImage c.GetAttrib("NegativeImage")</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> cnvs.Copy offScreenCnvsNeg1, LeftNegSrc, LeftNegDest</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> offScreenCnvsPos1.LoadImage c.GetAttrib("PositiveImage")</div><div> cnvs.Copy offScreenCnvsPos1, RightPosSrc, RightPosDest</div><div> sleep(4000)<span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span> offScreenCnvsPos1.LoadImage c.GetAttrib("Prompt")</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> cnvs.Copy offScreenCnvsPos1, RightPosSrc, RightPosDest</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> sleep(3000)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> </div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Dim theMouseResponseData As MouseResponseData </div><div><br></div><div> 'Get the mouse response </div><div> Set theMouseResponseData = </div><div><span class="Apple-tab-span" style="white-space:pre"> </span>CMouseResponseData(offScreenCnvsPos1.InputMasks.Responses(1)) </div><div><br></div><div> 'Determine string name of SlideImage or SlideText object at </div><div> 'mouse click coordinates. Assign that value to strHit </div><div> strHit = theState.HitTest(theMouseResponseData.CursorX, </div><div><span class="Apple-tab-span" style="white-space:pre"> </span>theMouseResponseData.CursorY) </div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span> <span class="Apple-tab-span" style="white-space:pre"> </span></div><div> case 2</div><div> offScreenCnvsNeg2.LoadImage c.GetAttrib("NegativeImage")</div><div> cnvs.Copy offScreenCnvsNeg2, RightNegSrc, RightNegDest</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>offScreenCnvsPos2.LoadImage c.GetAttrib("PositiveImage")</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>cnvs.Copy offScreenCnvsPos2, LeftPosSrc, LeftPosDest</div><div> sleep(4000)</div><div>end select</div><div><br></div><div>Please let me know what I can do to collect responses, assuming I have a prompt image that shows up in wither of the four rect options.</div><div><br></div><div>Thanks again,</div><div>Corona</div><br>On Friday, September 21, 2012 3:03:41 PM UTC-4, Corona wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Thank you for all your help in setting up the canvas images for the dot probe task. I think I was advised to use this option because we will be collecting pixel co-ordinate information, as well integrating other components into the task (eye tracking for example).<div><br></div><div>My canvas script allows me to load images side by side (say positive and negative). However, I am not sure how to randomize the locations in which the images appear (as in - positive images should randomly show up in either the left side or right, and similarly for the negative) . At any point, the screen has a positive and negative image pair, but the location (i.e. whether right or left) in which either of the two appear is unknown. My guess was to use the nested property to specify location, but I am not sure how to get this attribute (given that it is in a nested list) in the inline script for canvas. I am sorry if this sounds convoluted.Any help would be appreciated.</div><div><br></div><div>Thanks,</div><div>Corona</div></blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "E-Prime" group.<br />
To post to this group, send email to e-prime@googlegroups.com.<br />
To unsubscribe from this group, send email to e-prime+unsubscribe@googlegroups.com.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msg/e-prime/-/YLc9an3HmM0J">https://groups.google.com/d/msg/e-prime/-/YLc9an3HmM0J</a>.<br />
For more options, visit <a href="https://groups.google.com/groups/opt_out">https://groups.google.com/groups/opt_out</a>.<br />
<br />
<br />