Changing image position according to xy-coordinates from mouseclicks

David McFarlane mcfarla9 at msu.edu
Tue Jun 19 15:01:18 UTC 2012


Johannes,

Glad you sorted it out.  Just a bit of explanation about the 
":center", that happens when you use an attribute reference (e.g., 
[x]) for an X or Y Posiiton, and I do not think that PST explains 
this anywhere.  Think about it -- When you use an attribute 
reference, EP does not know until run time what position to use.  But 
during design time, it still has to place the object at some example 
position.  Where should it put the object during design time?  The 
":center" merely indicates where the object will appear on the 
*design* surface, and then the object will move to the referred 
position at *run* time.

And if you like, you could replace ":center" with a position of your 
choice.  E.g., "[x]:25%" would place the object 25% from the left of 
the design surface during design time, while "[x]:150" would place 
the object 150 pixels from the left during design time, and in each 
case would place the object at the value of [x] at run time.  Does 
that clarify things?

---------------
David McFarlane
E-Prime training 
online:  http://psychology.msu.edu/Workshops_Courses/eprime.aspx
Twitter:  @EPrimeMaster (twitter.com/EPrimeMaster)
---------------

Stock reminder:  1) I do not work for PST.  2) PST's trained staff 
take 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) In addition, PST takes questions at their Facebook page 
(http://www.facebook.com/pages/Psychology-Software-Tools-Inc/241802160683 
), and offers several instructional videos there and on their YouTube 
channel (http://www.youtube.com/user/PSTNET ) (no Twitter feed yet, 
though).  4) If you do get an answer from PST staff, please extend 
the courtesy of posting their reply back here for the sake of others.


At 6/19/2012 03:48 AM Tuesday, Johannes Bjerva wrote:
>I managed to solve the problem through using a global variable, 
>which is set by the mouse coordinates, rather than an attribute.
>That is to say, the problem was not in the automatic addition of 
>":center", as I first assumed.
>
>Problem solved! :)
>
>
>On Monday, 18 June 2012 21:53:18 UTC+2, Johannes Bjerva wrote:
>Hello,
>
>I am currently developing an experiment in which the participants 
>will click an area of the screen, following which an image should 
>appear in that location.
>
>What I have tried so far is having a slide object containing an 
>image object. In the image object's sub-property pages I've tried to 
>set the X and Y positions to the attributes "[PicPosX]" and
>"[PicPosY]". However, once I click apply, E-Prime automatically 
>changes this to "[PicPosX]:center" and "[PicPosY]:center".
>
>In order to get the coordinates themselves, I have added this 
>inline-code after the slide object:
>Dim theMouseResponseData As MouseResponseData
>Set theMouseResponseData = CMouseResponseData(Slide1.InputMasks.Responses(1))
>c.SetAttrib "PicPosX", theMouseResponseData.CursorX
>c.SetAttrib "PicPosY", theMouseResponseData.CursorY
>
>Obtaining the coordinates and setting the attributes seems to work 
>perfectly, since I can see the coordinates in the resulting data files.
>However, the image does not change positions, but remains in the 
>center (most likely due to E-Prime's :center-addition to my attributes).
>
>Any help in solving this problem would, of course, be greatly appreciated.
>
>Kind regards,
>Johannes Bjerva

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