This article applies to:
This sample demonstrates how to implement a 'drag and drop' feature. A sequence of colored boxes is presented to the participant in random order. The participant is then asked to reproduce the sequence by dragging the colored boxes to the locations in which they were originally presented.
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'.
Please sign in to leave a comment.