This article applies to:
E-Prime 3.0
E-Prime 2.0
E-Prime 1.x
Detail
This sample demonstrates how to implement a 'drag and drop' feature. This sample also shows how to check the location of the moved objects.
Abstract
The participant is free to click and drag any object on DragSlide expect for any objects explicitly skipped in the ClickAndDrag Inline Script. The coordinates of each draggable object are logged at the end of the ClickAndDrag Inline Script.
DragSlide has a Duration of 0, but the Time Limit on the Mouse Input Mask is specified as 'end of proc' so that the inputs from the participant can be used in the ClickAndDrag Inline.
The GetRelativeMousePos subroutine gets the position of the mouse in relation to the coordinate (0,0). This is required if the experiment is being run on a monitor other than the main display.
The ptDragOffset variable makes it so that the slide objects can be dragged relative to where the cursor clicks on them. Without the ptDragOffset, slide objects appear to 'jump' to the cursor.
Older versions (.es2 and .es) implement a click and drag differently. The 'PresentOrder' object presents three colored 'boxes'. Each box's color is selected randomly from the 'ColorList' List object. The 'Stimulus' object presents three "goal boxes" in the same position, along with three 'drag' boxes, each representing one color from the sequence.
When the subject presses the left mouse button, the 'Stimulus' object is terminated, and a HitTest is performed to determine which sub-object from the 'Stimulus' object was clicked. If the subject clicks the 'termination' sub-object, the trial ends. Otherwise, the 'CollectRelease' object runs. This object has a 'Duration' property of '0' and a response 'TimeLimit' property of '(infinite)', allowing the script contained in the 'MoveObjects' InLine to execute immediately while the 'CollectRelease' object is still collecting the response. If the subject clicked on one of the 'drag' objects, the 'MoveObjects' script will execute until a left mouse button release is collected by the 'CollectRelease' object. The program then jumps to the 'RedoTrial' label, and the subject can perform a click response again.
Once the 'termination' area is clicked, the 'CheckAccuracy' InLine checks the borders of each 'drag' object to see if they are within any of the 'goal' objects. If so, the color of the 'drag' object is logged in the corresponding attribute and the accuracy is assessed. If all three 'drag' objects are within the appropriate 'goal' object, the trial is evaluated as 'correct'.
Comments
0 comments
Please sign in to leave a comment.