Changing text inside a button when clicked
Hello all,
OK so I am trying to create an Operation Span task.
What I want to have is a grid with buttons and next to each button the name of a letter (please see the pic).
Participants have to press these buttons in a correct oder and a number (the position of letter in the flux of letters just presented) appear on the button.
So far, and I do not know if it is the good strategy, I just create a loop presenting forms. Every time the participant click on a button the script update and refresh the values in the buttons with a counter.
Issue I have right now:
- what I did might be too complicated and I wonder if something easier might not be possible;
- when clicked, numbers appear on the button but on top of the previously presented one and I do not know how to refresh my form without pausing the script and waiting for a refresh.
OK I hope my explanation is clear.
Thank you for any help!
Comments
Hi Sylvain,
Long time no see! Neither on the forum, nor in real life. I hope you're doing well.
Your situation is a perfect example of when the newly introduced named
Canvaselements come in handy. Here's one possible implementation. You could actually also use asketchpadto draw the display and name the elements, and then update theCanvasof this sketchpad (as in the video below).Cheers!
Sebastiaan
A video explanation of named elements:
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hey Sebastian,
Yeah long time not seeing you, I am in Germany these times. Next time I am around the lab I really have to come to say hello to everyone. Hope everything is fine for you guys!
Anyway wow this canvas object is so nice and your solution helped a lot!
I tweaked it a little bit so if anyone wants to use it to collect responses in OSPAN-like-task here is the part of the code. Will try to post the whole thing on osf anyway.