This article applies to:
E-Prime 3.0
E-Prime 2.0
Detail
This sample demonstrates three different methods to illustrate which portion of an image was selected by a mouse click.
Abstract
These sample experiments illustrate how to overlay different types of transparent Slide sub-objects on top of a SlideImage sub-object in order to identify which portion of the image was selected. The E-Prime 3.0 experiment uses SlideButtons as the transparent Slide sub-objects while the E-Prime 2.0 experiment uses SlideText sub-objects.
E-Prime 3.0
E-Prime 3.0 uses four equally sized and transparent SlideButtons placed over each of the four quadrants in the SlideImage. In the first block, the four transparent SlideButtons are configured to have the "Checked" status toggled each time the button is clicked by setting the AutoCheck property to "yes". (The AutoCheck property must be set with an attribute reference; see BUG: SlideButton AutoCheck and InitialCheck properties are ignored in E-Studio unless Attribute references are used [30606] for details.) The SlideButton's Checked Circumstance is configured to display a border around the selected quadrant (BorderWidth is changed from the default value of 0 to 5 and the BorderColor is set to red.) Therefore, when the SlideButton's status changes to Checked, the button is redrawn according to its Checked circumstance's properties. Accuracy is then presented based on the CorrectAnswer Attribute in the TrialList.
In the second block, Script Task Events are used instead of the Checked status (see E-STUDIO: Script Task Events [23603]). A Task Event is added to the Stimulus1 Slide for the Stimulus1.Button(1).Click Event . The task associated with this Event is to run the script routine named "ShowButtonClicked", which is defined in User Script. The Source parameter of the Event is set to Button. This passes the name of the Button that was clicked to the ShowButtonClicked routine. ShowButtonClick then sets the BorderWidth and BorderColor properties of the clicked SlideButton.
E-Prime 2.0
E-Prime 2.0 uses four equally sized and transparent SlideText sub-objects placed over each of the four quadrants in the SlideImage. When a mouse click is detected, the HitTest function is called. This function takes the mouse position when the mouse button was pressed as input and returns the name of the object beneath those coordinates. For details on the Hit Test function, see Response Areas for Mouse Input [30051]. If one of the four SlideText areas is returned by Hit Test, then its BorderWidth and BorderColor are assigned to be a thick red border and the Slide is redrawn so that the modified SlideText properties are applied.
Comments
0 comments
Please sign in to leave a comment.