Questions about clicking pictures


Author
Message
Sophia
Sophia
Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)
Group: Forum Members
Posts: 16, Visits: 1

Hi,



I am programming a sorting task to ask participants to click one picture among several pictures on the screen. When participants click one picture, I want to have a highlighted yellow frame appearing around the choosing picture. Please help to instruct how to do it. 



Meanwhile, I want to have a red frame constantly appear around the target picture. How to input a red frame here? Please help!



Thanks so much!!


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K

Use <shape> elements positioned behind your <picture> elements. When the respective picture is clicked on, change the color of the shape to the desired value.


Sophia
Sophia
Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)
Group: Forum Members
Posts: 16, Visits: 1

Thanks Dave. 


Now I know how to input a border of the target pictures.



But how to do this one? : "When the respective picture is clicked on, change the color of the shape to the desired value."


Sorry I dont know the language to do it. I need your further instructions. Thanks!


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K

Here's a minimal example:


<block myblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ stimulusframes = [1=f1,f2,p1,p2, done]
/ inputdevice = mouse
/ validresponse = (p1,p2,done)
/ ontrialend = [if(trial.mytrial.response=="p1")shape.f1.color=blue]
/ ontrialend = [if(trial.mytrial.response=="p2")shape.f2.color=blue]
/ branch = [if(trial.mytrial.response!="done")trial.mytrial]
</trial>

<text p1>
/ items = ("picture 1")
/ position = (40%,50%)
/ size = (100px, 100px)
/ erase = false
</text>

<shape f1>
/ shape = rectangle
/ position = (40%,50%)
/ size = (110px, 110px)
/ erase = false
</shape>

<text p2>
/ items = ("picture 2")
/ position = (60%,50%)
/ size = (100px, 100px)
/ erase = false
</text>

<shape f2>
/ shape = rectangle
/ position = (60%,50%)
/ size = (110px, 110px)
/ erase = false
</shape>

<text done>
/ items = ("Click here when done...")
/ position = (50%,90%)
/ erase = false
</text>


If you need a more comprehensive example, I recommend you work through the Information Sampling Task which uses a similar mechanic.


Sophia
Sophia
Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)
Group: Forum Members
Posts: 16, Visits: 1

Thanks so much!


Sophia
Sophia
Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)
Group: Forum Members
Posts: 16, Visits: 1

Hi Dave,



I got another question. 


When I click one picture in one trial, the frame will appear. But the frame will last forever!  I need the frame to disappear when I click next. Then start another trial. 


Please help. Thanks!


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K

You simply need to reset the respective shape element's color to whatever you need at the beginning of a trial then.


Sophia
Sophia
Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)
Group: Forum Members
Posts: 16, Visits: 1


<trial picture1>


/ inputdevice = mouse


/ ontrialbegin = [shape.left.color=black]


/ontrialbegin = [shape.right.color=black]


/ stimulusframes = [1=left,right,targetborder,left1,target1,right1,done]


/ validresponse = (left1, right1,done)


/ontrialend = [if(trial.picture1.response=="left1")shape.left.color=red]


/ontrialend = [if(trial.picture1.response=="right1")shape.right.color=red]


/ branch = [if(trial.picture1.response!="done")trial.picture1]


</trial>




If I define the shape color as black at the beginning of each trial like this, then the shape color will not change to red when I click it. 


I am confused.


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K


If I define the shape color as black at the beginning of each trial like this, then the shape color will not change to red when I click it. 


I am confused.



You are reverting any changes you made within a single trial. That's why.


1st run of the trial -> click on left shape -> left shape is set to red


2nd run of the trial -> left shape is set to back to black *before it is ever displayed*.



Sophia
Sophia
Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)
Group: Forum Members
Posts: 16, Visits: 1

then how to write it?? 


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search