psychopy.org | Reference | Downloads | Github

Editable Textbox not responding

Hi everyone,
I am working on an experiment right now and am having trouble with the editable textbox. I have two loops in the experiment that use an editable textbox. The first one works, as shown in the first image. The second editable textbox (second image) is unresponsive, and doesn’t show any red cursor, even though it has the exact same parameters as the first textbox. Is there any way to fix this?

Thank you!

Hi There,

Sounds like it is this known bug - try using the ‘use version’ option in experiment settings and selecting v 2020.2.3 Editable textBox not working in conditional loop

Becca

Hi Becca,

I tried to use the old version you mentioned, but the second textbox still doesn’t respond, even after closing down Psychopy and restarting it.

Hi There,

Please could you share your experiment file with us there so that we can take a look ? :slight_smile:

Becca

CortexMini.psyexp (42.3 KB)

Hi There,

Thank you for sharing this, this seems to be a bug. I have logged this as an issue on github here https://github.com/psychopy/psychopy/issues/3267 and will tag @TParsons so that he has the context for this issue.

Sorry that you are experiencing this, but thank-you for flagging it to us so that we can resolve it.

Becca

Thank you!

Is there another way of using a textbox in place of this in the meantime?

Sadly for the moment I would have to suggest reverting to the old method of getting typed responses… steal the code components from this demo!

This is a mix of being a bug and not - what’s happening here is that the Mouse component is listening for mouse clicks, so when you click on the Textbox (to give it focus), the click is picked up by the Mouse component rather than the Textbox. If you replace the Mouse component with some other method of ending the routine, as you have in the previous Routine, it should work!

However, this is also a bug as an editable textbox should have focus by default, without needing to be clicked on. I think what’s happening is that focus is remaining on the (no longer drawn) textbox from the previous Routine, similar to how only one Textbox would start off with focus if you had two on screen at the same time. Even though it’s not being drawn, the first Textbox still exists, so PsychoPy is seeing it as the main one. I’ll add a bug fix to bring control to a textbox if it is the only one on screen!

Thank you! I am trying to use a code component to either have the spacebar or the enter key end the routine with this:

keys = event.getKeys()

if 'space' in keys:
    continueRoutine = False

But the textbox is still unresponsive. Is there a way I can use these keys to end the routine with the textbox?

Hi There,

If you want the space key to be used to end the routine I would just add a standard keyboard component for this - Are you still working from the same gitlab repository so that I can take a look where you are at?

Becca

Hi Becca,

Yes, I am still working from the same one:
CortexMini.psyexp (43.2 KB)

Hi There,

Using the textInput demo posted above you can copy and paste the code and text component into your experiment. To then make it so that the space also ends the routine the following edit was needed:

    if 'space' in keys:
        continueRoutine = False

I have adapted the routine in your task where you wanted a typed response in order to illustrate (please note I removed any reference to the xlsx files as I didn’t have them

This should do what you need for now though, just use the same method in your other routines :slight_smile:
CortexMini.psyexp (41.3 KB)

Becca

Hi Becca,

This works really well, thank you! I do have one question about capitalization of the responses - is there a way to use capslock instead of shift? I tried to use it earlier on in code when I was working on this experiment, but it didn’t seem to be processing the key.

Hi There,

Fantastic - pleased it works - please cold you mark that response as the ‘solution’ for future users?

For your second Q, capslocks is a difficult one because the keycode for capslock on mac isn’t currently recognised (Caps locks button is not working) is it essential for you to have capslocks logged in your responses?

Becca

Hi Becca,

The reason I wanted to use capslock was because with shift, the user has to press it every single time they want to capitalize a letter, so I was trying to find an alternative to that. Is there something that would capitalize the letters without them having to do this?

is it that you want all typed letters to be capitals or that you want participants to type sentences and letters are capitalized appropriately?

I would like all the typed letters to be capitalized.

try this (see the subtly change made to the code_2 component) CortexMini (2).psyexp (41.4 KB)

essentially you just want to make sure any time a letter is added to the text object is is in upper case i.e. on the python side (left) everything reads:
text.text = text.text + keys[0].upper()
and on the JS side (right) everything reads
text.text = text.text + textAdd.toUpperCase();

Hopefully this does what you need,
Becca

The letters are all capitalized, thank you! However, whenever keys like ‘backspace’ are pressed, those also show up on the screen capitalized. Is there a way I can erase those so they don’t show up?