Using spacebar to accept and close a "text_input" form
Hi!
I'm using the great new option to measure key release (Thank you Sebastiaan and team!
).
I have a slide where participants need to release the sapcebar to move to a text_input form where they write
their response.
Right now to accept and close the form, the 'return' key should be pressed.
Is there a way (preferably with as less coding as possible) to use the spacebar instead of return?
Thanks,
Tali

Comments
and one more thing: I need the spacebar to be pressed when the target slide appears.
Is there a way to define "run if spacebar is pressed"?
Hi Tali,
in a
run iffield, probably not, but in aninline_scriptyou could implement a while loop that runs until a key has been pressed, and while it has not been released. Unfortunately, this is not exactly "with as less coding as possible"With the other question, I can't really help you. maybe you can Monkey patch the form execution function so that accepts also space presses, but for that you need to understand how Opensesame runs forms (better than I do). Maybe @sebastiaan has a nifty solution for that?
Eduard
Thanks for responding Eduard.... This is one of these times when I wish I had some computer science knowledge
What if I design a form by myself? can I use anything other than enter ?
Hi,
If you are willing to use a mouse, you can disable the return key, and use a
nextbutton instead?The only real solution that I can think of is to monkey patch the
Keyboardclass such that space keys are remapped to return keys. The script below does this, using a so-called decorator aroundget_key(). This will affect all key presses though!Check out SigmundAI.eu for our OpenSesame AI assistant!
Thanks! I'll try this